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 |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-07-19 : 07:00:12
|
Hi,Can you see if this query is correct?I would like to make sure the select query returns fieldID only if any of the fields inside the bracket (field4, 5, 6, 7) has changed.--has anything for this record changed?...--if so, add it into the Differences table...select fieldIDfrom tblTablewhere fieldID = @fieldID and fieldID2 = @NB and ( field3 != @field3 or field4 != @field4 or field5 != @field5 or field6 != @field6 or field7 != @field7 ) |
|
pootle_flump
1064 Posts |
Posted - 2007-07-20 : 04:00:16
|
Can any of the parameters or fields be null? |
 |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-07-20 : 04:22:01
|
Yes |
 |
|
pootle_flump
1064 Posts |
Posted - 2007-07-20 : 05:45:37
|
Then it will not work. If field3 is NULL and @field3 is 'something' then field3 != @field3 will return NULL, not true as you would like. |
 |
|
|
|
|