Skip to content
Advertisement

Is it possible to execute a text file from SQL query?

I have a number of generated .sql files that I want to run in succession. I’d like to run them from a SQL statement in a query (i.e. Query Analyzer/Server Management Studio).
Is it possible to do something like this and if so what is the syntax for doing this?

I’m hoping for something like:

I am using SQL Server 2005 and running queries in management studio.

Advertisement

Answer

use xp_cmdshell and sqlcmd

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement