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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Computing new variable from other variables

Author  Topic 

PHOanalyst
Starting Member

2 Posts

Posted - 2007-09-06 : 07:33:16
Dear All.
I'm a fairly new SQL programmer so apologies if this is a silly question.

I'm trying to create a new column/variable from 3 other variables where the new column = column 1 unless column 1 is blank, then = column 2, unless column 2 is blank, then = column 3.

But I don't know where in my query to begin building this. Should I build it in a subquery? Thanks in advance for any replies.

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2007-09-06 : 07:35:25
Lookup COALESCE.
Go to Top of Page

PHOanalyst
Starting Member

2 Posts

Posted - 2007-09-06 : 10:47:46
Thank you. Coalesce worked perfectly.
Go to Top of Page
   

- Advertisement -