By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,362 Members | 1,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,362 IT Pros & Developers. It's quick & easy.

@@rowcount

P: 40
What is @@rowcount and with small code snippet explain the usage?
Apr 24 '08 #1
Share this Question
Share on Google+
3 Replies


P: 92
What is @@rowcount and with small code snippet explain the usage?
If you just search for it out first you will be able to find the answer. I recommend google.com.

@@RowCount returns the number of rows affected by the last statement.
Anyway, here are some simple snippets that could explain @@rowcount:
For example, if you have these records on a myTable:
ID - Name
-----------------------
1 - Apple
2 - Orange
3 - Grapes
Expand|Select|Wrap|Line Numbers
  1. select * from myTable '@@rowcount = 3
  2. select * from myTable where ID = 3 '@@rowcount = 1
  3. update myTable set Name = 'Banana' where ID in (1,2) '@@rowcount = 2
  4. set @variable = 'Hello' '@@rowcount = 1
To learn more, click this .
Apr 25 '08 #2

ganeshkumar08
P: 31
@@Rowcount - Returns the number of rows affected by the last statement.

For Example.
If Table1 Has 20 rows in the DB.
If we execute the query as below
select * from Table1
Print @@Rowcount

Now the above stmt returns 20 rows, so the count will be 20.

Ganesh
Apr 25 '08 #3

P: 40
Thx both of U frnds..........I Got it.
Apr 25 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.