Dynamic SQL pp 101-118 | Cite as

Managing Scope

  • Edward Pollack


The chapters covering security have alluded to the fact that Dynamic SQL does not run in the same scope as the remainder of TSQL in the same stored procedure. In addition to breaking the ownership chain, variables declared locally and globally will not have easy access to each other. When writing application code or stored procedures, passing variables into and out requires a bit of planning, ensuring that the inputs and outputs are correct. Working with Dynamic SQL is very similar, and luckily there are a variety of ways in which to manage variables effectively without any level of inconvenience.


Temporary Storage Output Parameter Error Message Table Variable Permanent Object 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Copyright information

© Ed Pollack 2016

Authors and Affiliations

  • Edward Pollack
    • 1
  1. 1.AlbanyUSA

Personalised recommendations