Posted By

hairajeshk on 04/07/11


Tagged

sql dynamic chars 4000


Versions (?)

Dynamic sql more than 4000 chars


 / Published in: SQL
 

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

  1. –Following IS a sample dynamic sql string
  2.  
  3. –Break your dynamic string LIKE this
  4.  
  5. SET @q1 =SELECT * ‘Â Â
  6.  
  7. SET @q2 =FROM HumanResources.Department ‘
  8.  
  9. SET @q3 =WHERE DepartmentId=1
  10.  
  11. Â
  12.  
  13. –Now execute them together
  14.  
  15. EXEC (@q1 + @q2 + @q3)

Report this snippet  

You need to login to post a comment.