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 |
|
Mannga
Yak Posting Veteran
70 Posts |
Posted - 2003-08-27 : 08:05:49
|
| Hi All,I have an application that has to update data in a table, the problem is that it must only update a row if the field "Changed" is set to 0.I am running a loop in my application that is updating thousands of rows and was wondering if there is an easy SQL way to check before I update and then to tell me that it hasn't.???Thanks,Gavin |
|
|
dsdeming
479 Posts |
Posted - 2003-08-27 : 08:19:00
|
If your loop is updating one row at a time, include WHERE Changed = 0 in your WHERE clause and then check @@ROWCOUNT to see if any rows were updated. This doesn't check before the update, but it ensures that you get feedback when no update occurs.Dennis |
 |
|
|
Mannga
Yak Posting Veteran
70 Posts |
Posted - 2003-08-27 : 08:41:20
|
| Dankie.... (Thanks) :PWorks like a charm |
 |
|
|
|
|
|