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
 query problem??????????

Author  Topic 

sweet_777
Starting Member

16 Posts

Posted - 2010-10-06 : 23:35:08
Hi all,

I have one table called emp,columns are email1,email2,email3,email4,email5.values are
null,empty,null,empty,y@a.com
empty,null,x,empty,null

i have written query like this:

select email1+email2+email3+email4+email5 from emp
o/p i am getting:Null

but i want to get like this:

y@a.com
x

Regards
Rama

Thanks & Regards
Sweet_77

sql-programmers
Posting Yak Master

190 Posts

Posted - 2010-10-07 : 00:48:04
try this,

select coalesce(email1,'')+coalesce(email2,'')+coalesce(email3,'')+coalesce(email4,'')+coalesce(email5,'') from emp

SQL Server Programmers and Consultants
http://www.sql-programmers.com/
Go to Top of Page
   

- Advertisement -