473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

@@rowcount

What is @@rowcount and with small code snippet explain the usage?
Apr 24 '08 #1
3 2095
deric
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
@@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
Thx both of U frnds..........I Got it.
Apr 25 '08 #4

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

Similar topics

1
by: FLORAL | last post by:
One Update statement in my following function UpdateSuccess_Order goes like this: Function UpdateSuccess_Order(ByVal Ord_No, ByVal Ord_NoSuccess, ByRef strError) UpdateSuccess_PAL = "ERROR"...
1
by: Papri Chakravorty | last post by:
hello i have been trying to connect to a table an error keeps coming up in html that the total rows is less than total row count also an error in the datagrid, that the index number is not same as...
2
by: louis | last post by:
When I need to perform an update against multi-million row table I typically specify @@rowcount, to reduce locks. e.g. set @@rowcount 1000 while exists (select * from myTable where col2 is...
5
by: wackyphill | last post by:
Is Set RowCount @RowCount More efficient than simply using TOP? Thanks for any input.
3
by: Dimitri Furman | last post by:
SQL Server 2000 SP3. Is it possible for the @@ROWCOUNT function to return NULL after a statement? I am troubleshooting a relatively large stored procedure with multiple SELECT statements and a...
4
by: Richard G | last post by:
I'm a database guy, so go easy on me here. :) How can I get the rowcount of the affected rows of a SQL statement from a stored procedure call? I know that "set nocount on" does not return the...
3
by: Jon Haakon Ariansen | last post by:
Hi, I realize that it's not possible to get the rowcount from SqlDataReader, but if you have a stored procedure where you return @@ROWCOUNT it should be possible to get the rowcount through the...
1
by: SePp | last post by:
Hello all, I want to display the number of items in an datagridview. I use this one datagridview for different datasets. The datagridview.Rowcount works fine for the most of the dataset. But...
3
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.