Re: Using temporary table in in dynamic SQL

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 09/09/04


Date: Fri, 10 Sep 2004 02:53:20 +0530

you can not reference a table variable inside dynamic sql , if the variable
is defined ouside the scope of dynamic sql statement.

ex:
declare @var table (idd int)

exec ('select * from @var') --error out, because @var is defined outside the
scope.

exec ('declare @var table (idd int) insert into @var values (1) select *
from @var') --successful

-- 
Vishal Parkar
vgparkar@yahoo.co.in | vgparkar@hotmail.com


Relevant Pages

  • Re: function pointers vs direct calling in javascript
    ... scope tree to look for 'tempVar2' or for some other reason? ... Here is what I think of 'var', correct me if I am wrong. ... 'var' doesn't as such declare a variable. ... a property of the global object when the code executes. ...
    (comp.lang.javascript)
  • Re: function pointers vs direct calling in javascript
    ... //lots of entries in tempVar here ... Detailed explanation of the use of the var keyword? ... to *declare* variables or put them in the symbol tree in javascript. ... variable in a scope which is local to this function. ...
    (comp.lang.javascript)
  • Re: function pointers vs direct calling in javascript
    ... scope tree to look for 'tempVar2' or for some other reason? ... Detailed explanation of the use of the var keyword? ... to *declare* variables or put them in the symbol tree in javascript. ... variable in a scope which is local to this function. ...
    (comp.lang.javascript)
  • Re: Default argument values for blocks
    ... >This one was proposed long ago as a way to declare a var whose scope is ... All sorts of things can work, ...
    (comp.lang.ruby)
  • Re: Dynamic variable names
    ... Note that var defines the scope of a variable. ... variable you initialize belongs to the scope where it has been ... But it has been added no assignment yet, ...
    (comp.lang.javascript)