Calling .SQL Scripts

aarons44aarons44 Posts: 32
edited May 4, 2007 11:33AM in SQL Backup Previous Versions
Can I call .SQL scripts from the command line? I don't see the syntax anywhere. I'm replacing a batch file that makes heavy use of SQLCMD to restore databases and run .sql scripts against them.

Comments

  • Eddie DEddie D Posts: 1,807 Rose Gold 5
    Hi

    Sorry I am a little confused with your question.

    Red Gate SQL Backup provides a comand line utility so you can perform back and restore operations in any SQL Script or batch files that you create.

    The SQL Backup command line executable is call SQLBackupC. It is located in the folder in which you installed the SQL Backup Server Components, by default this is C:\Program Files\Red Gate\SQL Backup\<instance name>.

    The SQL Backup command line interface uses a subset of the T-SQL Backup and Restore statements.

    Further advice on using the SQL Backup Command Line Interface can be found in the SQL Backup Help file.

    If I have understood your post correctly, the answer is no you cannot use the SQL Backup Command Line Interface to call other .SQL Scripts.

    However you can include SQL Backup Command Line Interface into any .SQL Scripts that you create.

    Eddie Davis
    Red Gate Software Ltd
    Technical Support Engineer
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Thanks, you answered it for me. Basically, I have a script that uses SQLCMD to restore databases, and then uses SQLCMD to call .SQL files that make updates to the databases. The .SQL files aren't just simple SQL commands, they're complex scripts that are about 100 lines of code each. That's why they're stored in .SQL files rather than just executing the commands directly with SQLCMD - there is a lot of processing that goes on in the scripts as well. I was easily able to replace the restore part with SQLBackupC. I was hoping to call the .SQL files with SQLBackupC as well, so I would only have to use one program. It's not a big deal though. SQLBackupC does the restore and SQLCMD calls the scripts.



    Hi

    Sorry I am a little confused with your question.

    Red Gate SQL Backup provides a comand line utility so you can perform back and restore operations in any SQL Script or batch files that you create.

    The SQL Backup command line executable is call SQLBackupC. It is located in the folder in which you installed the SQL Backup Server Components, by default this is C:\Program Files\Red Gate\SQL Backup\<instance name>.

    The SQL Backup command line interface uses a subset of the T-SQL Backup and Restore statements.

    Further advice on using the SQL Backup Command Line Interface can be found in the SQL Backup Help file.

    If I have understood your post correctly, the answer is no you cannot use the SQL Backup Command Line Interface to call other .SQL Scripts.

    However you can include SQL Backup Command Line Interface into any .SQL Scripts that you create.

    Eddie Davis
    Red Gate Software Ltd
    Technical Support Engineer
Sign In or Register to comment.