Execute multiples files.sql from sqlcmd

  • In SQLSERVER 2005,

    I'ts possible execute files from a files.sql?

    Like sqlplus :

    --- install.sql

    @preinstall.sql

    @install.sql

    @postinstall.sql

    exit;

    or Mysql:

    --- install.sql

    source preinstall.sql

    source install.sql

    source postinstall.sql

    Thanks,

  • Ok I found it!

    Thanks,

    http://msdn.microsoft.com/en-us/library/aa833281.aspx

    Supported SQLCMD Syntax

    You can use the following commands:

    :r FileName

    Parses additional Transact-SQL statements and SQLCMD commands from the file specified by FileName into the statement cache. FileName is read relative to the startup directory for Visual Studio. The file is read and executed after a batch terminator is encountered. You can issue multiple :r commands. The file can include any SQLCMD command, including the batch terminator that is defined in Tools, Options. You can use :r in a pre-deployment or post-deployment script to include other scripts.

Viewing 2 posts - 1 through 2 (of 2 total)

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