Getting the values of the affected row.
-
If we delete or update a row in a table; the no of changed row shows as n rows affect. Here is the example. Ex: update TableName set Column1='N' where Column2=2 Output: 4 rows affected In this i need to get the value 4. How to fetch that value. Can anyone help me out :doh:
Regards, LEE
-
If we delete or update a row in a table; the no of changed row shows as n rows affect. Here is the example. Ex: update TableName set Column1='N' where Column2=2 Output: 4 rows affected In this i need to get the value 4. How to fetch that value. Can anyone help me out :doh:
Regards, LEE
In SQL Server you can get this value by using the global variable
@@rowcount
. The variable contains data about the number of rows affected by a sql statement and is updated each time you run a statement.