SQL help!

pctweak

OSNN Junior Addict
Joined
26 Sep 2004
Messages
13
How do i get the following to work in a .bat file. I have to manually type this in each time and it sucks. When I put it in a .bat or .cmd file it will not work..
Thanks Adam


Osql –Usa –Pais
pause
drop database aisdb

go
restore database aisdb from disk='C:\aisbackup\ais_backup.dat' with
move 'AIS' to 'C:\program files\ais\rxsign\aisdb.mdf',
move 'AIS_log' to 'C:\program files\ais\rxsign\aisdb_log.ldf'
go
Pause
 
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]

Looks like you can use the osql -i to use an input file.
 
Leave it up to Microsoft to confuse people :p. All others have their tool named after the SQL product.

mysql
psql
fbrd (FireBird, dun know if they still do)
sqlite

osql does not fit in with any database engine I know :p
 
X-Istence said:
Leave it up to Microsoft to confuse people :p. All others have their tool named after the SQL product.

mysql
psql
fbrd (FireBird, dun know if they still do)
sqlite

osql does not fit in with any database engine I know :p

sure.. that's why oracle's command line tool is called sqlplus..
 
fitz said:
sure.. that's why oracle's command line tool is called sqlplus..

Hrm, I did indeed forget about Oracle, however on the machines I have worked on with Oracle the command line was always called orasql.
 
I did get this to work. Made a cmd file that called a .sql file and that worked great
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back