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.
| Author |
Topic |
|
Grifter
Constraint Violating Yak Guru
274 Posts |
Posted - 2010-05-20 : 12:05:52
|
| HiI have three fields from a table (all varchar) that I am trying to concatenate in a procedure but when I add the third field all it does is return nulls?Code is like this:Select.......,.......,(Field1 + Field2 + Field3) AS ConcatFieldFrom Table1As I said it is ok until I add the third field.ThanksG |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-05-20 : 12:17:24
|
| Field3 should contain NULLS. Check out the ISNULL or the COALESCE function. |
 |
|
|
flamblaster
Constraint Violating Yak Guru
384 Posts |
Posted - 2010-05-21 : 05:00:54
|
| Select coalesce(field1,'')+coalesce(field2,'')+coalesce(field3,'')from table1should work |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-05-21 : 05:52:25
|
| We can use coalesce for multiple option!Here isnull() will play a better role! Select isnull(field1,'')+isnull(field2,'')+isnull(field3,'')from table1Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
Grifter
Constraint Violating Yak Guru
274 Posts |
Posted - 2010-06-16 : 11:09:32
|
| Thanks, used is null. |
 |
|
|
|
|
|