Skip to main content
3 of 4
updated with clearer code as suggested
Dave
  • 2.4k
  • 1
  • 12
  • 20

Create an initial Execute SQL Task in the Control Flow and use the following code in it:

IF ((SELECT CAST(SERVERPROPERTY('ProductVersion') as CHAR(2))) = 11)
    BEGIN
        SELECT 'TRUE' As Result
    END
    ELSE
        SELECT 'FALSE' As Result

You can of course do several things with this, one of the easiest and clearest for SSIS developers would be to store the results in a SSIS variable and assign the Precedent Constraint after the SQL Task to Expression and Constraint.

If the Execute SQL Task Succeeds and returns TRUE it will allow the rest of the execution, which could be a single package, part of a larger execution stream, or a master package. If it fails or returns FALSE your package stops... might be worth putting in another path for an alert message or log of this though.

Dave
  • 2.4k
  • 1
  • 12
  • 20