Using sqlcmd

SQL Servers sqlcmd function is a means of accessing and running SQL Server from the command line. Most things you can do within the SQL Server GUI you can do at the command prompt.

The bad news is that I will not be doing an in depth expose on all of that functionality on this website. The good news is I will be covering what I feel are the essentials of using the sqlcmd function. I suppose how you view this news is a matter of your own perspective. There are many sites and pages on the internet that cover the facets of sqlcmd I will not be covering.

What is Wrong With SQL Server Management Studio?

There is nothing wrong with that tool. It works just fine for many database development and adminstration functions you might want to perform. Additionally, there are many after market GUI tools that allow you to perform various development and administration tasks, though these can get pricey depending on how many seat you need to buy. Though good aftermarket software in the right hands can pay for itself in productivity gains over the Native SQL Server tools.

Why Use SQL Server Command Line?

Three important reasons come to mind

  1. It can be quicker for certain operations than using the GUI tool.
  2. It allows you to write T-SQL and easily run them at the command line.
  3. You can call sqlcmd functions in languages like Perl and Php

IItems two and three interest me the most. I am very much into process automation where I can as this leaves more time for the work I consider to be more challenging and more enjoyable. Being able to execute sqlcmd line functions within a host language like Perl and Php allows one to build a variety of tools. Eventually I may share of these here, but for now I will just over some basics.


 Collapse All    Expand All
Custom Search

SQL Server Information and Resources