• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

SQL help!

pctweak

OSNN Junior Addict
#1
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
 

fitz

Woah.. I'm still here?
Staff member
Political User
#3
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.
 

X-Istence

*
Political User
#6
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
 

fitz

Woah.. I'm still here?
Staff member
Political User
#7
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..
 

X-Istence

*
Political User
#8
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.
 

Members online

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,013
Latest member
Pdawgintown