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 |
|
fmardani
Constraint Violating Yak Guru
433 Posts |
Posted - 2007-01-16 : 07:01:40
|
| hello,This is the update query that I have created.Let's say @UnderlyingIndexID is to be set to null.I think this query does not allow for such an update.How can this query be altered to do so?Thanksupdate tblTestset IsActive = isnull(@IsActive, IsActive), UnderlyingIndexID = isnull(@UnderlyingIndexID, UnderlyingIndexID), LastUpdatedUser = @ActiveUser, LastUpdatedDate = getdate()where IndexID = @IndexID |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-16 : 07:05:40
|
| Seems fine to me.But we do not know your business rules. Is the column supposed to be set to NULL when parameter is NULL? If so, just remove the ISNULL for that line.Peter LarssonHelsingborg, Sweden |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-01-16 : 07:06:43
|
[code]update tblTestset IsActive = isnull(@IsActive, IsActive), UnderlyingIndexID = isnull(@UnderlyingIndexID, UnderlyingIndexID) @UnderlyingIndexID, LastUpdatedUser = @ActiveUser, LastUpdatedDate = getdate()whereIndexID = @IndexID[/code] KH |
 |
|
|
|
|
|
|
|