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 ...
Get Alison Balter's Mastering Access 2002 Enterprise Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.