Created
April 25, 2023 15:33
-
-
Save deangrant/51aa6f8839dc6602dd7ff55ed8c78fd5 to your computer and use it in GitHub Desktop.
Provides example of conditional update in SQL if column value is specified
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE {{ table_name }} | |
SET {{ column_name }} CASE WHEN {{ value}} IS NOT NULL THEN {{ value }} ELSE {{column_name }} END | |
WHERE {{ column_name }} = {{ value }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment