O'Reilly logo

Alison Balter's Mastering Access 2002 Enterprise Development by Alison Balter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the @@Functions

Developers often refer to the @@Functions as global variables. In fact, they don't really behave like variables. You cannot assign values to them or work with them as you would work with normal variables. Instead, they behave as functions that return various types of information about what is going on in SQL Server.

@@RowCount

The @@RowCount variable returns the number of rows returned by a selected statement or affected by a statement that modifies data. It returns 0 if no values are returned by the SELECT statement or modified by the action query. Here's an example:

SELECT CustomerID, CompanyName
FROM Customers
WHERE Country = 'USA'
SELECT @@RowCount as NumUSACusts

The example selects all customers in the country of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required