Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2011
    Posts
    3

    Unanswered: Help Loading a .sql file

    Is there a way to load a .sql file using sql syntax?

    Say I have a file, query.sql.

    Query.sql contains the following:

    Select * from table

    Now I want to run the select statement in query.sql, but I don’t want to load it from the icon or by “file – open” in Query Analyzer. I want to call on the .sql file using sql syntax. Is there a way to do that?
    Last edited by jackflash; 07-19-11 at 02:08.

  2. #2
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    SQLCMD -i input_file
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

  3. #3
    Join Date
    Jul 2011
    Posts
    3
    SQLCMD -i input_file

    Didn't work.

    I get the error: invalid syntax near i

  4. #4
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    SQLCMD is run from a commandline. Are you trying to run that in SQL Server Management Studio?

  5. #5
    Join Date
    Jul 2011
    Posts
    3
    Yes and no, I tried from a cmd prompt and then from the studio. After neither worked, I did a little research and found out that SQLCMD is a utility. However I can't find where to download it for server 2008 r2. After reading about it, it sounds like it would be great, but where can I get it at?

  6. #6
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2

Posting Permissions

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