SQL help!

Discussion in 'Web Design & Coding' started by pctweak, Mar 18, 2006.

  1. pctweak

    pctweak OSNN Junior Addict

    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
     
  2. LordOfLA

    LordOfLA Godlike!

    Messages:
    7,027
    Location:
    Maidenhead, Berkshire, UK
    can you not give Osql a command file to read from disk?
     
  3. fitz

    fitz Just Floating Along Staff Member Political User Folding Team

    Messages:
    4,076
    Location:
    Chicagoland
    Looks like you can use the osql -i to use an input file.
     
  4. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    What SQL server is OSQL?
     
  5. NetRyder

    NetRyder Tech Junkie Folding Team

    Messages:
    13,256
    Location:
    New York City
    Looks like a command-line tool for MS SQL Server.
     
  6. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    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
     
  7. fitz

    fitz Just Floating Along Staff Member Political User Folding Team

    Messages:
    4,076
    Location:
    Chicagoland
    sure.. that's why oracle's command line tool is called sqlplus..
     
  8. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Hrm, I did indeed forget about Oracle, however on the machines I have worked on with Oracle the command line was always called orasql.
     
  9. pctweak

    pctweak OSNN Junior Addict

    Messages:
    13
    I did get this to work. Made a cmd file that called a .sql file and that worked great