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 |
|
Luke101
Starting Member
30 Posts |
Posted - 2009-06-18 : 09:13:57
|
| Hello,Every time I try to add a NULL with a string I always get a NULL. Is there a way i can change this behavior or is there a way to deal with this? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-18 : 09:36:09
|
Use COALESCE or ISNULL. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Luke101
Starting Member
30 Posts |
Posted - 2009-06-18 : 11:18:02
|
| Would you happen to have any syntax examples? |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-06-18 : 11:45:29
|
| SELECT field3 = coalesce(field1, '') + coalesce(field2,'')from urtable |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-18 : 12:24:52
|
You mean other syntax than described in Books Online, the SQL Server help file? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Luke101
Starting Member
30 Posts |
Posted - 2009-06-18 : 21:40:18
|
| I am doing something like thisupdate table set column1 = column1 + 'MyString' where column2 = 10column 1 always returns a NULL |
 |
|
|
waterduck
Aged Yak Warrior
982 Posts |
Posted - 2009-06-18 : 22:11:18
|
| update table set column1 = COALESCE(column1,'') + 'MyString' where column2 = 10ps.It works but i not sure it meet yours requirement, plz wait peso and others pro to double confirm it |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-06-19 : 00:10:25
|
quote: Originally posted by Luke101 I am doing something like thisupdate table set column1 = column1 + 'MyString' where column2 = 10column 1 always returns a NULL
The column1 has null value in the table, that's why u got the column1 value as null. check the column1 with isnull or coalesce |
 |
|
|
|
|
|