Can "Execute SQL Task" do this?

  • The DTS "Execute SQL Task" allows me to enter a single SQL statement. But I need to execute multiple SQL statements, one after the other. Can "Execute SQL Task" do this?

    TIA,

    Bill Salkin

  • Yes, I've used it to execute multiple SQL statements. For instance, I have a single Execute SQL Task that truncates several database tables all within the same "task."

    K. Brian Kelley

    bk@warpdrivedesign.org

    K. Brian Kelley
    @kbriankelley

  • In addition to having the ability to run multiple sql statements, you can commit or rollback transactions.

  • do this in the exec sql task object:

    <statement here>

    GO

    <statement here>

    Go

    and continue as you need to for any statement you like. Always test to ensure errors are propogated as you require.


    Chris Kempster
    www.chriskempster.com
    Author of "SQL Server Backup, Recovery & Troubleshooting"
    Author of "SQL Server 2k for the Oracle DBA"

  • If you're running SQL 2K, make sure you have SP1 installed when doing this. I had some issues where my GO statements were bugging out.

    Brian Knight

    bknight@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bknight

Viewing 5 posts - 1 through 4 (of 4 total)

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