SQLCMD Mode (SQL Management Studio)

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.

No Comments