SQL Server Command Line Tools
SQL Server ships with many command prompt utilities. The command line tools are located in the c:\Program Files\Microsoft SQL Server\100\Tools\Binn directory.
Detailed information about the available tools can be found at:
http://msdn2.microsoft.com/en-us/library/ms162816(SQL.90).aspx.
We recommend using the osql utility, which allows you to enter Transact-SQL statements, system procedures, and script files. This utility uses ODBC to communicate with the server. More information about osql can be found at:
http://msdn2.microsoft.com/en-us/library/ms162806(SQL.90).aspx.
You can start the osql program from the command prompt:
The E parameter enables trusted mode using Windows authentication (you have to be logged into Windows with the proper user authorization).
The following example selects the most recent 10 records stored in the section table, which includes Verba call detail records: