Using the Command-Line Tools

The graphical administration tools provide just about everything you need to work with SQL Server. Still, there are times when you might want to work from the command line, especially if you want to automate installation, administration, or maintenance with scripts. The primary command-line tool is SQLCMD.EXE, which replaces OSQL.EXE and ISQL.EXE. Another command-line tool you’ll use is BCP.EXE.


BCP is the bulk copy program. You can use BCP to import and export data or copy data between instances of SQL Server 2008. The major advantage of BCP is its speed. It is much faster than standard database import/export procedures. Unfortunately, its command-line syntax makes it much harder to use.

The syntax for BCP is shown ...

Get Microsoft® SQL Server® 2008 Administrator's Pocket Consultant now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.