1. Computing

SQLCMD Step-by-Step

By , About.com Guide

3 of 6

Connecting to the Database
SQLCMD Step-by-Step
Mike Chapple
Once you have a command prompt open, you use the SQLCMD utility to connect to the database. In this example, we're connecting to the AdventureWorks2008 database, so we use the command:

sqlcmd -d AdventureWorks2008
This uses the default Windows credentials to connect to your database. You may also specify a username using the -U flag and a password using the -P flag. For example, I could connect to the database using the username "mike" and password "goirish" with the following command line:

sqlcmd -U mike -P goirish -d AdventureWorks2008
  1. About.com
  2. Computing
  3. Databases
  4. SQL Server
  5. Connecting to the Database

©2013 About.com. All rights reserved.