Wednesday, March 7, 2012

How to Call a Script from T-SQL

Hello all,
I have a SQL script file with some statements in it. ... say c:\sai.sql. I want to call it through a T-SQL Procedure...Please let me know the process
SaiIf you DON'T need the script to run under the same SPID as your procedure you could always go the xp_cmdshell & i/osql route.

If you need to run under the same SPID, then you could load your script into a one row by one column table, select the text into a local variable and EXECUTE the variable.

No comments:

Post a Comment