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 |
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2009-07-15 : 07:01:31
|
I want to concantenate two fields and place the result in a temporary field and have been using:USE DebtGOUPDATE DebtorSET TempField = KeyInformation + ' ' + NextLegalAction However, the KeyInformation field can contain a NULL, which creates a NULL in the TempField also.How can I have the TempField contain the contents of the NextLegalAction field if the KeyInformation field contains a NULL please? |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-07-15 : 07:07:02
|
| UPDATE DebtorSET TempField = ISNULL(KeyInformation,'') + ' ' + ISNULL(NextLegalAction,'') |
 |
|
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2009-07-15 : 07:18:04
|
quote: Originally posted by bklr UPDATE DebtorSET TempField = ISNULL(KeyInformation,'') + ' ' + ISNULL(NextLegalAction,'')
Aha! Many thanks for educating me. |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-07-15 : 07:18:58
|
quote: Originally posted by OldMySQLUser
quote: Originally posted by bklr UPDATE DebtorSET TempField = ISNULL(KeyInformation,'') + ' ' + ISNULL(NextLegalAction,'')
Aha! Many thanks for educating me. 
welcome u can use coalesce also in place of isnull |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-07-15 : 13:34:46
|
quote: Originally posted by OldMySQLUser
quote: Originally posted by bklr UPDATE DebtorSET TempField = ISNULL(KeyInformation+ ' ','') + ISNULL(NextLegalAction,'')
Aha! Many thanks for educating me. 
slight modification to avoid the unecessary space in case of NULL |
 |
|
|
|
|
|