Reputation: 15
I'm looking to check my SourceCode variable for Null values and then convert all Nulls to the text value BaseSource. Before I run this on live data I want to make sure that is what the following code will do:
,case ISNULL(SourceCode,' ')when ' ' then 'BaseSource'
else SourceCode end
Can I expect that with this code Null values will first be converted to a blank spaces, and then to BaseSource within the current SourceCode column?
Thank you.
Upvotes: 0
Views: 43
Reputation: 11105
In SQL SERVER
you can use a syntax like this:
UPDATE YourTable SET SourceCode = ISNULL(SourceCode, 'BaseSource')
Before UPDATE
your live data you can try this SELECT:
SELECT ISNULL(SourceCode, 'BaseSource') FROM YourTable
Upvotes: 0