I don't know why I can't find anything about this, but how would one go about using an 'if' statement in a view?
Looking to show SN if FSN is blank. both are text fields.
What is the data type for FSN?
What is the data type for SN?
When FSN is "blank", does this mean an empty string, or is it NULL?
If a "blank" FSN is really NULL, and the data types for FSN and SN are the same, then you could use the Coalesce function, like this....
[tt]
Select Col1,
Col2,
[!]Coalesce(FSN, SN) As SomeAliasName,[/!]
etc...
[/tt]
The Coalesce function will return the value in the first parameter if it is not NULL. If the first parameter is NULL, then it will return the value in the second parameter.
-George
Microsoft SQL Server MVP My Blogs SQLCop twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.