Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi, I got a SP where it does something like:select ... [Headlinedate] ... [Publishdate]Order by [Headlinedate]But since headlinedate was not required up until now, headlinedate might return a NULL.So when it returns a NULL, I want to replace it with [publishdate] which always has a value.Can I do something like:select ... if headlinedate <> null headlinedate else publishdate end if ....order by if headlinedate <> null headlinedate else publishdate end ifThe secret to creativity is knowing how to hide your sources. (Einstein)
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts
Posted - 2009-02-09 : 08:55:49
yeah, You could do that. Just use the right syntax...