Table Variable Scope

Table Variable Scope

Post by Jerem » Sat, 02 Aug 2003 00:12:05



Hi there,

Wondering if someone could answer a simple question for
me (at least I think it is simple).

Is a table variable global only to a single instance of a
proc being run?  Lets say client app A and client app B
both call the same stored proc at the same time.  Will
they share the same table variable (each storing info in
only one table variable) or will they each have their own
table variable that holds each persons info seperately?

I would think each would have it's own, but the way my
app is responding, it sure seems like they are sharing
it.  Any hints on how to seperate the two if they are in
fact sharing it?

Thanks

 
 
 

Table Variable Scope

Post by Narayana Vyas Kondredd » Sat, 02 Aug 2003 00:14:46


Scope of table variables is local to the procedure or batch that created it,
just like normal variables. For more information on table variables check
out this KB article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;305977

--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on?
http://vyaskn.tripod.com/poll.htm


Hi there,

Wondering if someone could answer a simple question for
me (at least I think it is simple).

Is a table variable global only to a single instance of a
proc being run?  Lets say client app A and client app B
both call the same stored proc at the same time.  Will
they share the same table variable (each storing info in
only one table variable) or will they each have their own
table variable that holds each persons info seperately?

I would think each would have it's own, but the way my
app is responding, it sure seems like they are sharing
it.  Any hints on how to seperate the two if they are in
fact sharing it?

Thanks

 
 
 

1. VB 3.0 loosing scope of global table variables

I have been having a lot of problems when using VB3.0 and Access2.0.  I set up
table variables is a source code module for Global access and then open up the
tables in my main form.  I access these tables from other forms in the project
without any problem.  As I add code to these forms,  Vb suddenly comes up with
a message saying my table variable has not been defined/set up even though
that same line of code was working a few minutes earlier.  To get around this
problem,  I have to Dim the variable in the form I am having a problem with
and then use the set command to set it up again.  Whats up ?????

Any help will be greatly appreciated !

Regards, Mark Stevens.

2. euro symbol

3. Session-scope variables

4. Attaching / Detaching in TRUE path having some problem.

5. Local variable scope problem

6. Presenting TESTING COMPUTER SOFTWARE (TCS2000) Conference -- Featured

7. Help, variable in FROM clause keeps dropping out of scope

8. Double connection to database treated as one connection

9. Session-scope variables

10. Variables with scope enough for my script

11. Session-scope variables

12. Variable scope and Batches

13. Why is this variable losing scope?