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 |
|
agarwasa2008
Posting Yak Master
109 Posts |
Posted - 2009-12-18 : 16:24:57
|
Hi I have @SomeColName. If the value is '' ie empty string then replace it with NULL. Therefore I wish to assign a null if it does not contain a value. How can I do that.Stored Prodecure@col1,@col2,@col3ASBegininsert into table1(col1, col2, col3)select @col1, @col2, @col3;EndSA |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-18 : 16:33:59
|
| [code]select @SomeColName = nullif(@SomeColName,'')[/code] |
 |
|
|
agarwasa2008
Posting Yak Master
109 Posts |
Posted - 2009-12-18 : 16:49:54
|
| I get the following error:'ifnull' is not a recognized built-in function name.SA |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-18 : 16:53:34
|
quote: Originally posted by agarwasa2008 I get the following error:'ifnull' is not a recognized built-in function name.SA
Not sure where you got ifnull from?? did u read my post....it's nullif() |
 |
|
|
agarwasa2008
Posting Yak Master
109 Posts |
Posted - 2009-12-18 : 17:03:21
|
| Thanks Vijayisonly!! I am a programmer by profession and so in between phone calls and myraid of other things I changed nullif to ifnull. Thanks a bunch!! SA |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-18 : 17:08:25
|
| Np. You're welcome |
 |
|
|
|
|
|