Script Database Changes Using OSQL
Filed under:
Deployment Solution, Software Delivery Solution, Notification Server
3rd Party Products, Database, Scripting, Command Line
Submitted by CondorMan on 25 June, 2008 - 15:58.
OSQL is a flexible command-line utility that allows you to run SQL Queries, Commands, and Stored Procedures from the command-line or through a Batch script.
In order to run OSQL, you can either run it on your SQL Server or copy OSQL.EXE and osql.rll to a location that a client machine can run them from.
The syntax for OSQL is:
usage: osql [-U login id] [-P password] [-S server] [-H hostname] [-E trusted connection] [-d use database name] [-l login timeout] [-t query timeout] [-h headers] [-s colseparator] [-w columnwidth] [-a packetsize] [-e echo input] [-I Enable Quoted Identifiers] [-L list servers] [-c cmdend] [-D ODBC DSN name] [-q "cmdline query"] [-Q "cmdline query" and exit] [-n remove numbering] [-m errorlevel] [-r msgs to stderr] [-V severitylevel] [-i inputfile] [-o outputfile] [-p print statistics] [-b On error batch abort] [-X[1] disable commands [and exit with warning]] [-O use Old ISQL behavior disables the following] <EOF> batch processing Auto console width scaling Wide messages default errorlevel is -1 vs 1 [-? show syntax summary]
(21 votes)
- Login or register to post comments
- 656 reads
- Printer-friendly version
















Recent comments
16 hours 39 min ago
16 hours 56 min ago
19 hours 11 min ago
19 hours 13 min ago
23 hours 23 min ago
1 day 15 min ago
1 day 1 hour ago
1 day 4 hours ago
1 day 4 hours ago
1 day 5 hours ago