Reputation: 498
here I wanted to check if coming value is empty string or null then use value from Db column.Like I did for is null case. How can i check for empty string in this line of code.Please suggest
II.[NAME] = isNull(IIMODEL.[Name], II.[NAME]),
Upvotes: 1
Views: 57
Reputation: 1269853
Why not just use explicit comparisons?
(II.[NAME] = IIMODEL.[Name] OR IIMODEL.[Name] IS NULL OR IIMODEL.[Name] = '')
I think the logic is much simpler to follow.
Upvotes: 1
Reputation: 14231
II.[NAME] = ISNULL(NULLIF(TRIM(IIMODEL.[NAME]), ''), II.[NAME])
Upvotes: 2