Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: SQL
Expertise: Intermediate
Oct 14, 2016



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Using the @@rowcount Global Variable in SQL

After each Transact-SQL statement, the server sets the value of this variable to the total number of records affected by it. It can be used to verify the success of selected operations:

SQL Server sets the value of the @@rowcount variable after each T-SQL statement to the total number of records affected by the statement. The @@rowcount variable is usually used to verify success of a certain query. Here is a small example:

SELECT ID, StudentName, StudentSurname, StudentAge

INTO AugustStudents

FROM CurrentStudents

WHERE CourseFinishDate < '2016-09-01'

IF @@rowcount = 0

PRINT "No rows were copied!"
Hannes du Preez
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date