Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Posts
    1,245

    Unanswered: Batch T-SQL Scripts

    In Horacle (thanks to someone else for the apt pseudonym), I am able to run a PL/SQL script saved as a file by simply typing in @ plus the path and file name. So, if I have a script called E:\CreateTable.sql, I can simply enter @CreateTable.sql from the SqlPlus command line and Oracle will attempt to run all the commands in the E:\CreateTable.sql file (there may be one or more commands).

    Can I do the same thing in Query Analyzer (or even osql)? If so, what is the correct syntax?

    Thanks,

    hmscott
    Have you hugged your backup today?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I don't know of a way to do it from a script in either Query Analyzer or OSQL, but you can open a new file in Query Analyzer and execute it that way and you can use the ED command in OSQL to allow you to incorporate the file (via the editor) there too.

    -PatP

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Not that I've seen...the closest is

    File>Open>filename.sql

    [CTRL]+E

    And Whore-acle is so much more painful in SQL+....I guess each has it's own pluses...

    Did you ever use mask.sql?

    Oh, and osql could run in a command line pretty easily....just make sure you redirect the output....

    But why bother, unless you're releasing a script to production...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Dec 2002
    Posts
    1,245
    Thnx guys. Just wishful thinking....
    Have you hugged your backup today?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •