RSS

@@ROWCOUNT in MS SQL Server

23 Oct

Returns the number of rows affected by the last statement. If the number of rows is more than 2 billion, use @@ROWCOUNT_BIG.

Use the following code:-

USE [MyDB]

UPDATE [Customers]
SET [Country] = ‘Egypt’
WHERE [Country] = ‘A.R.E’

IF @@ROWCOUNT = 0
PRINT ‘Zero (0) rows affected by last T-SQL command.’

 
Leave a comment

Posted by on October 23, 2011 in MS SQL Server

 

Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: