Return to Snippet

Revision: 44207
at April 7, 2011 20:45 by hairajeshk


Initial Code
–Following is a sample dynamic sql string 

–Break your dynamic string like this
 
SET @q1 = ‘SELECT * ‘Â Â  

SET @q2 = ‘FROM HumanResources.Department ‘
 
SET @q3 = ‘WHERE DepartmentId=1′
 
 
 
–Now execute them together 

EXEC (@q1 + @q2 + @q3)

Initial URL
http://blog.namwarrizvi.com/?p=121

Initial Description

                                

Initial Title
Dynamic sql more than 4000 chars

Initial Tags
sql

Initial Language
SQL