Chapter 9. Dynamic SQL

Itzik Ben-Gan

Dynamic SQL (code that is executed dynamically), like cursors and temporary tables, is an area of T-SQL that should be used with care and caution. It has the potential to be used in an unsafe way and could lead to serious security breaches and code that performs badly and is difficult to maintain. On the other hand, when used wisely, dynamic SQL can help you achieve things that would be difficult to achieve any other way. And in some cases it is the only way you can provide good performance.

Note

Note

I’ll discuss some of the potential security breaches involved with dynamic SQL later in the chapter under the section ...

Get Inside Microsoft® SQL Server® 2008: T-SQL Programming 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.