ABS
ALL
AND
ANY
AVG
bit
COS
COT
DAY
EXP
GO
IN
LEN
LOG
MAX
MIN
NOT
OR
PI
SET
SIN
STR
SUM
TAN
USE
VAR
Expand Minimize
8 out of 12 rated this helpful - Rate this topic

@@ROWCOUNT

SQL Server 2000

  Topic last updated -- July 2003

Returns the number of rows affected by the last statement.

Syntax

@@ROWCOUNT

Return Types

integer

Remarks

This variable is set to 0 by any statement that does not return rows, such as an IF statement.

If the table has more than 2 billion rows, use ROWCOUNT_BIG(). For more information, see ROWCOUNT_BIG().

Examples

This example executes UPDATE and uses @@ROWCOUNT to detect if any rows were changed.

UPDATE authors SET au_lname = 'Jones'
WHERE au_id = '999-888-7777'
IF @@ROWCOUNT = 0
   print 'Warning: No rows were updated'

See Also

@@ERROR

System Functions

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.