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