Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

SQL Server - The power of @@rowcount, and the pit falls, if you do not use them correctly!

Aug 9 2010 1:32AM by Madhivanan   

Lot of newbies struggle to unserstand how @@Rowcount works in SQL Server. @@Rowcount is used to know the number of rows affected for the last select,insert,update or delete statements. You should use @@rowcount immediately after the statement

For example the following returns 1 row

select 100

To get row count, use @@rowcount immediately after the statemnet

select 100
select @@rowcount

It returns the values 100 and 1

Don't make any checkings directly on @@rowcount and assign it's value to a variable.

declare @row int
select 100
if @@rowcount>1
set @row=@@rowcount
--do some stuff

The above will return 0 becuase as soon as if @@rowcount>0 is executed it is reset to 0 as it doesn't return any rows. So always assign to variable first

declare @row int
select 100
set @row=@@rowcount
if @row>0
--do some stuff

Tags: t-sql, sql_server, tsql, BRH, #TSQL, @@rowcount,


Madhivanan
3 · 40% · 12924
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"SQL Server - The power of @@rowcount, and the pit falls, if you do not use them correctly!" rated 5 out of 5 by 1 readers
SQL Server - The power of @@rowcount, and the pit falls, if you do not use them correctly! , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]