Running SQL Script in Query Analyzer or ISQL

  • Hi,

    How can a sql script be run from query analyzer or DOS (ISQL) without using File -> Open? What I am looking for is a command which is similar to '@' in Oracle to run sql scripts stored in file directory.

    Thx

  • I thinks it's difficult to replicate this Oracle functionality.

    However, in osql (or a sql script submitted to osql) you can try host commands (!!) that also call osql. ie. insert lines such as:

     
    
    !! osql -E -Q"select 1"

    or

     
    
    !! osql -E -i script2.sql

    Cheers,

    - Mark


    Cheers,
    - Mark

  • http://www.15seconds.com/issue/011106.htm

    There is a better example of reading SQL batches from files and applying through OSQL, using the vbscript / FileSystemObject. Cannot find it!. Will have a look again over the weekend.

  • Thanks for the information

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply