Skip to main content
updated with clearer code as suggested
Source Link
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.

You can also use (SELECT @@VERSION) LIKE 'Microsoft SQL Server 2014%'. I like this as it's a more familiar version nomenclature.

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.

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.

You can also use (SELECT @@VERSION) LIKE 'Microsoft SQL Server 2014%'. I like this as it's a more familiar version nomenclature.

updated with clearer code as suggested
Source Link
Dave
  • 2.4k
  • 1
  • 12
  • 20

Create an initial Execute SQL Task in the Control Flow and use the following code in it (you could change to a LIKE statement or paste your exact system expectations in place of the SQL 2014 output I have here):

IF ((SELECT @@VERSIONCAST(SERVERPROPERTY('ProductVersion') = 'Microsoft SQL Server 2014 - 12.0.4213.0as CHAR(X642) 
    Jun  9 2015)) 12:06:16= 11)
    Copyright (c) Microsoft CorporationBEGIN
    Enterprise Edition: Core-based Licensing (64-bit) on WindowsSELECT NT'TRUE' 6.3As <X64>Result
 (Build 9600: ) (Hypervisor)
')
BEGINEND
    SELECTELSE
 '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.

You can modify the IF check for different possibilities:

IF ((SELECT @@VERSION) LIKE 'Microsoft SQL Server 2014%'

Or as @billinkc suggests and you were headed originally:

IF ((SELECT CAST(SERVERPROPERTY('ProductVersion') as CHAR(2))) = 11)

Create an initial Execute SQL Task in the Control Flow and use the following code in it (you could change to a LIKE statement or paste your exact system expectations in place of the SQL 2014 output I have here):

IF ((SELECT @@VERSION) = 'Microsoft SQL Server 2014 - 12.0.4213.0 (X64) 
    Jun  9 2015 12:06:16 
    Copyright (c) Microsoft Corporation
    Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
')
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.

You can modify the IF check for different possibilities:

IF ((SELECT @@VERSION) LIKE 'Microsoft SQL Server 2014%'

Or as @billinkc suggests and you were headed originally:

IF ((SELECT CAST(SERVERPROPERTY('ProductVersion') as CHAR(2))) = 11)

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.

updated with alternate options
Source Link
Dave
  • 2.4k
  • 1
  • 12
  • 20

Create an initial Execute SQL Task in the Control Flow and use the following code in it (you could change to a LIKE statement or paste your exact system expectations in place of the SQL 2014 output I have here):

IF ((SELECT @@VERSION) = 'Microsoft SQL Server 2014 - 12.0.4213.0 (X64) 
    Jun  9 2015 12:06:16 
    Copyright (c) Microsoft Corporation
    Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
')
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.

You can modify the IF check for different possibilities:

IF ((SELECT @@VERSION) LIKE 'Microsoft SQL Server 2014%'

Or as @billinkc suggests and you were headed originally:

IF ((SELECT CAST(SERVERPROPERTY('ProductVersion') as CHAR(2))) = 11)

Create an initial Execute SQL Task in the Control Flow and use the following code in it (you could change to a LIKE statement or paste your exact system expectations in place of the SQL 2014 output I have here):

IF ((SELECT @@VERSION) = 'Microsoft SQL Server 2014 - 12.0.4213.0 (X64) 
    Jun  9 2015 12:06:16 
    Copyright (c) Microsoft Corporation
    Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
')
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.

Create an initial Execute SQL Task in the Control Flow and use the following code in it (you could change to a LIKE statement or paste your exact system expectations in place of the SQL 2014 output I have here):

IF ((SELECT @@VERSION) = 'Microsoft SQL Server 2014 - 12.0.4213.0 (X64) 
    Jun  9 2015 12:06:16 
    Copyright (c) Microsoft Corporation
    Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
')
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.

You can modify the IF check for different possibilities:

IF ((SELECT @@VERSION) LIKE 'Microsoft SQL Server 2014%'

Or as @billinkc suggests and you were headed originally:

IF ((SELECT CAST(SERVERPROPERTY('ProductVersion') as CHAR(2))) = 11)
Source Link
Dave
  • 2.4k
  • 1
  • 12
  • 20
Loading