© Ed Pollack 2016

Edward Pollack, Dynamic SQL, 10.1007/978-1-4842-1811-2_5

5. Managing Scope

Edward Pollack

(1)Albany, New York, USA

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.

What Is Scope?

To make ...

Get Dynamic SQL: Applications, Performance, and Security now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.