Tips category – General
Cisco TMS Database Knowledge Tips Page 15 of 35
TIP T109 –Using osql for Cisco TMS tasks
Cisco TMS Versions SQL Server Versions
All
SQL v7 – All Versions
MSDE – All Versions
SQL 2000 – All Versions
MSDE 2000 – All Versions
SQL 2005 – All Versions
SQL 2005 Express – All Versions
osql is the command line utility installed with SQL server. For SQL Server 2005, osql has been
superseded by the new sqlcmd utility, but is still available for use. osql may be intimidating to users for
server configuration tasks, but is well suited for quick changes or simple queries. Many instructions or
changes from Tech Support may be listed using osql for its precision and general availability. osql is best
used by opening a dedicated command prompt on the Windows Server. It will be added to the path for
Windows, so it can be executed without having to navigate to a specific directory.
For Cisco TMS related tasks, the osql syntax needed is simple. Syntax help can be seen by using osql
-?
Note that command line switches are case sensitive!
The most common switches used with Cisco TMS operations are listed below
Switch Description
-S
server\instance
Specifies the SQL Server Address to connect to. Can be a hostname, IP or
WINS name. Connect to a named instance by appending \instancename
Examples:
-S
prodsql.company.com\sqlexpress
-E
Use Windows Authentication to authenticate to the SQL Server. Will try
connecting to the server using the username and password you logged
into the computer with
-U username
Use SQL Server Authentication with the specified username. If –P
parameter is not specified, login is attempted with a NULL password.
Examples:
-U sa
Connect using username sa
-U john.smith
Connect using username
john.smith
-P password
Use SQL Server Authentication with the specified password. Used in
conjunction with the –U option. If –P is specified but no password supplied,
the system will prompt for the password when the command is executed
Examples:
-U sa –P coolPass
Login using account sa with
password coolPass
-U sa -P
Login using account sa but prompt
for password