Run command-line stuff from SSMS via SQLCMD Mode  

Posted by ReelTym

By entering SQLCMD mode in a SQL Server Management Studio query window, you can do some very handy things without needing to jump back out to the command prompt. Commands can be run just like at the command prompt, by prefixing the line with "!!" a la:

!!bcp MyDatabase.dbo.MyImportedTable in c:\temp\sqlimport.dat -Umydbuser -Pmydbpass -Smydbserver -n


And by executing (ctrl+e) that line, it'll import your database... easy, and if you save in a database project, you can even have these included in the source control flavor of your choice.

This entry was posted on Saturday, April 09, 2011 and is filed under . You can leave a response and follow any responses to this entry through the Subscribe to: Post Comments (Atom) .

0 comments