SQL Server Performance

How to run a sqlfile inside sql query analyzer

Discussion in 'General Developer Questions' started by gansdba, Apr 3, 2004.

  1. gansdba New Member

    Is there a way to run a sqlfile from query analyzer or some other way.
    I have some 20 sql files to run,
    I am tired of opening it in sql query analyzer and run each time.

    I would really appreciate if anyone can help on this.

    Thanks,
    Ganesan S.



    Thanks,
    Ganesan S.
  2. derrickleggett New Member

    Look at the osql utility. It will run from a command prompt. Our SourceSafe procedure, looks at a directory using xp_cmdshell (loads it into a temp table) and builds osql strings. It then runs the entire batch of osql commands and logs them to a table.

    It's a pretty neat utility and there's a lot of information about it in Books Online. If you do a search on this forum and sqlteam.com, you will also find a lot of examples to cut and paste.

    Derrick Leggett

Share This Page