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 |
flamz
Starting Member
21 Posts |
Posted - 2008-03-28 : 10:59:35
|
Hi,Is there a way to know whether UPDATE actually updated data?I have a situation where I call a bunch of UPDATE queries without really knowing if the data I am UPDATING is different.Is there a way to issue a query that would tell me "Thanks for UPDATING, but the data was the same, so no action was taken".Cheers. |
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-03-28 : 11:01:36
|
sounds like you want a triggerEm |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-28 : 11:02:35
|
Or use @@ROWCOUNT system variable.And add a WHERE clause that checks for every column updated is not the same as before. E 12°55'05.25"N 56°04'39.16" |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-28 : 11:12:59
|
UPDATE Table1SET Col1 = @col1,Col2 = @col2WHERE Col1 <> @col1 OR Col2 <> @col2SELECT @@ROWCOUNT E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|