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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-09-08 : 09:05:26
|
| Matthew writes "I have a strange problem with an SQL statement.The statement is very simple:"update table1 set field1 = x where field2 = y"I am executing this statement from within a transaction using ado from my Delephi 5 application.In my live database, this statement has failed to update all the rows it should have in 3 cases. It has been executed successfully in all of the other 1,500 times it has been run.Do I need to check the number of rows affected after every SQL statement to determine if an error has occurred? In this case i would have to do a selct statement first to find out how many rows should be updated?Thanks in advance for any help you can offer, this is driving me crazy.Regards,Matthew" |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-09-08 : 09:20:11
|
| You may not get an error in every case where the data wasn't updated. It may be that the WHERE clause was never evaluated to true. You will generally get an error on syntax (which won't be the case, because it sometimes works), or if there is a data type mismatch somewhere. You'll need to make sure your error handler isn't running over this.You can also check the number of rows affected to be sure. |
 |
|
|
|
|
|