By now, you probably have realized that dynamic SQL holds within it great power and, at the same time, great risk. By using dynamic SQL wisely, you can get great performance benefits and flexible solutions. Using it unwisely often leads to lengthy, inefficient code that is open to attacks that can cause havoc in your system.

Get Inside Microsoft® SQL Server™ 2005 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.