1. Home
  2. Computing & Technology
  3. Databases

SQLCMD Step-by-Step

By Mike Chapple, About.com

3 of 6

Connecting to the Database

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
Explore Databases
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Databases
  4. SQL Server
  5. Connecting to the Database

©2009 About.com, a part of The New York Times Company.

All rights reserved.