SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Installing SQLCMD

For anyone who wasn’t aware SQLCMD is a command line tool for running T-SQL statements and scripts. Before anyone says anything I want to point out that yes, I realize that you can use Powershell instead. Of course not all of us know Powershell all that well and most of us do know T-SQL. Until that changes (and I expect it will) SQLCMD (or some form of it) will be around.

What are some common uses for SQLCMD?

  • Run scripts on remote servers.
    SQLCMD can easily be used to run a script or stored procedure on a remote SQL Server. Combining this with a bat file (yes, again older technology) and an Enterprise scheduler (because not all of us use SQL Server Agent) can be a very powerful way to run T-SQL.
  • Connecting to the DAC
    The DAC (dedicated admin connection) is vitally important when you have problems with your SQL Server. It has its own dedicated resources and can be used even when no other connections may be able to do anything. SQLCMD is a light weight way of connecting and fixing your server.

 
SQLCMD is installed with SSMS and with the database engine. This means it’s going to be installed on the server where your instance is located and probably your workstation as well. However every now and again you want it installed on a machine where no SQL components are installed. Say an application server. It’s not overly difficult fortunately. You just download and install the Command Line Utilities for SQL Server.


Filed under: Microsoft SQL Server, SQLServerPedia Syndication, T-SQL Tagged: command line, microsoft sql server, T-SQL

SQLStudies

My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.

Comments

Leave a comment on the original post [sqlstudies.com, opens in a new window]

Loading comments...