What’s wrong with using SQL Server Management Studio (SSMS)? Nothing! What’s wrong with you! Well, I’m in a hurry.
As much as I love GNR Patience, I don’t have any… well not so much of it. Thanks Smart Phone era.
I always use SQLCMD when SSIS is not available– not all of my customers install SSIS along with SQL. I once had a project where I had to scan through terabytes of files to find certain image files. Once the files were found, it would immediately write the path to the database. Since this had to be performed and completed over the weekend, I ran hundreds instances of my C# application to seek out the files.
So here’s how it works
In the command prompt (cmd.exe), run sqlcmd /? and you’ll see the following
There’s a lot of options and the ones I frequently use are
-S Server Name
-E Trusted Connection
In the example below, I’m querying a table, however you can always call a stored procedure to INSERT/DELETE/UPDATE/SELECT your data instead of writing out the query– SP is safer
I hope this gives you some insight as to why/when you would use SQLCMD