[thelist] SQL Server & Stored Procedures

Scott Dexter sgd at ti3.com
Tue Oct 30 17:18:14 CST 2001


> 
> I'd like to take issue with this... are you SURE? This 

it was long time ago, MSSQL Server 6.5, and has sat in my memory since.
(We've not looked into it since MSSQL 7 came out)

> doesn't sound right,
> and when I checked with our DBA he actually snorted. :)

yeah, well, okay

> 
> If you HAVE observed this behaviour, then I would suggest 
> it's a bug in your
> version of SQL, because that is incorrect behaviour... 
> @@rowcount should be
> a per-connection value.

hmm, lemme check SQL Books Online:

Global Variables (Level 4)
Pre-SQL Server 7.0
Global variables were those system-supplied, predeclared variables that
were distinguished from local variables by having two at symbols (@@)
preceding their names.

SQL Server 7.0
Transact-SQL global variables are a form of function and are now
referred to as functions. 

Recommendations  
Expect different results as compared to earlier versions of SQL Server.
For more information, see Functions.  

So looks like the behavior did change, as inline with your find:

> 
> 	"These functions are global only in the sense that any 
> 	 connection can access their values. However, in many cases 
> 	 the value returned by these functions is specific to the 
> 	 connection. For example, @@ERROR represents the last error 
> 	 number generated for a specific connection, not the last error 
> 	 number in the entire system. @@ROWCOUNT represents the number 
> 	 of rows selected or affected by the last statement for the 
> 	 current connection. "
> 


So @@rowcount isn't a server global variable anymore, its a system
function. G'head and use it then =)

(but do I mention IIS uses the same ODBC connection for multiple
requests?)

sgd




More information about the thelist mailing list