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 |
|
DaveBF
Yak Posting Veteran
89 Posts |
Posted - 2011-02-22 : 08:47:16
|
| I have a parameterized Update query, and in certain cases, I want to leave a column as it was. So for example, if I haveUpdate mytable Set Amount=@Amount, Name=@Name where myID=@IDis there a way to say don't change the Amount?Thanks,Dave |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-02-22 : 08:49:42
|
you can pass in NULL to @Amount and use COALESCE() tUPDATE mytable SET Amount = COALESCE(@Amount, Amount). . . EDIT : typo err KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
DaveBF
Yak Posting Veteran
89 Posts |
Posted - 2011-02-23 : 11:17:44
|
| Thank you! |
 |
|
|
|
|
|