What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 4702 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > SQL Server > Number Of Rows Affected - @@ROWCOUNT ...
Akiii

Number Of Rows Affected - @@ROWCOUNT

 Code Snippet posted by: Akiii | Posted on: 7/9/2012 | Category: SQL Server Codes | Views: 407 | Status: [Member] | Points: 40 | Alert Moderator   


@@ROWCOUNT returns the number of rows affected by the last statement. For example :-

UPDATE table_name 

SET first_name = 'Dotnetfunda'
WHERE id = 1
IF @@ROWCOUNT = 0
print 'No rows were updated';


In the above example, table is updated where id = 1 . If there is no row affected then it will print a message.



Thanks and Regards
Akiii
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 12:46:03 AM