|
Home > Archive > SQL server exams > November 2002 > Coco's Question of the Week #17
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Coco's Question of the Week #17
|
|
| cocolocopolo 2002-10-30, 11:30 pm |
| RE: RowCount
I tried to understand what is @row and @@rowcount, but unfortunately
the more I tried, the more I confused.
What I understand is: '@row is a local variable and @@rowcount is a
global variale'. But what do they perform?
Similarly, what is the difference between @error and @@error?
Why we have to use local and global variables? | |
|
| Single '@' character is used to identify local variables or parameters(in procedures and UDFs).
Variables like @row are defined using Declare eg
Declare @row int,@row1 char(20),@row2 sql_variant
and can be used by programmer for any user-defined logic in script, procedure or UDF.
Double '@@' is used yo specify some MS defined system functions, eg @@rowcount. "global variables" are out-of-date name for those functions and in SQLServer 2000 this term should not be used.
MS have changed thier notation style and do not used '@@' prefix for their new system functions. Eg new function ROWCOUNT_BIG() doesn't have the prefix, but old @@ROWCOUNT has the prefix.
System functions should be used where appropriate depending of their functionality as documented in MSSQL BOL | |
| cocolocopolo 2002-11-01, 11:46 pm |
| Thanks dear MNF. |
|
|
|
|