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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Simple query to check number of rows processed

Author  Topic 

Robert London
Starting Member

26 Posts

Posted - 2010-08-07 : 05:36:43

Hi,

Could anyone help me with a query to check the number of rows processed on a query I have running?

Thanks,

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-08-07 : 06:08:51
select @@rowcount will give you the number of rows affected by the query


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Robert London
Starting Member

26 Posts

Posted - 2010-08-07 : 06:16:05
What would the full query be?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-08-07 : 07:45:19
1) SET @Variable = @@ROWCOUNT
2) SELECT @Variable = @@ROWCOUNT



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-08-07 : 12:47:46
try this:

the second select will hold number of rows returned from first query. you can insert values from @@rowcount into table for auditing purposes.

select * from MyTable
select @@rowcount
Go to Top of Page
   

- Advertisement -