Hi Balmukund ,
Thanks for your suggestion , I agree with you . I was just trying to answer on how to form dynamic SQL .
We can insert XML data into XML variable and also with temp table , to handle global temp table , Can it be done this way :
EXEC('SELECT * FROM ##temp_'+@SPID)sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.
Correct Sathya. I was just trying to explain that we need to add session handling. Your new query looks perfectly fine.
Balmukund Lakhani | Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
--------------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------------------------------------------------------------------
My Blog | Team Blog | @Twitter
Author: SQL Server 2012 AlwaysOn - Paperback, Kindle
No comments:
Post a Comment