Is there a command line interface where I can run a script that says, for example: Connect to server a Run query 1 Connect to server b Run query 2 Run query 3
I tried searching online but couldnt find anything built into SQL Server Management Studio. Thanks!
The sqlcmd Utility
http://msdn.microsoft.com/en-us/library/ms162773.aspx
It usually ships with the SQL Server installer and is located in the following directory by default:
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE
If you want to export in/out there is a command-line utility called BCP that will let you execute these types of processes.
bcp Utility
The bcp utility bulk copies data between an instance of Microsoft SQL Server and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into SQL Server tables or to export data out of tables into data files. Except when used with the queryout option, the utility requires no knowledge of Transact-SQL. To import data into a table, you must either use a format file created for that table or understand the structure of the table and the types of data that are valid for its columns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With