SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Package variables reference environment variables?


Package variables reference environment variables?

Author
Message
slimchance99
slimchance99
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1724 Visits: 252
I have a package where network file paths are set up as package parameters, and these parameters are referenced in package variables that concatenate with file names read from file enumeration loops. Something like @[$Package::parWorkingFIlePath] + @[User::usrXMLFileNamePath]

Everything works fine in VS. My deployment plan was to use environment variables to read in the testing/production file paths from environment variables to the parameters on the server. On the server all of the variables that reference the package parameters populated from the environment variables fail validation, with a message that the 'expression cannot be parsed'.

I saw a mention somewhere that environment variables cannot be referenced by package variables. Is this the case? If so what would be the best method to pass the folder paths to the package variables?

Thanks



Attachments
Capture.PNG (5 views, 6.00 KB)
Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)

Group: General Forum Members
Points: 137525 Visits: 22866
slimchance99 - Monday, February 5, 2018 2:08 PM
I have a package where network file paths are set up as package parameters, and these parameters are referenced in package variables that concatenate with file names read from file enumeration loops. Something like @[$Package::parWorkingFIlePath] + @[User::usrXMLFileNamePath]

Everything works fine in VS. My deployment plan was to use environment variables to read in the testing/production file paths from environment variables to the parameters on the server. On the server all of the variables that reference the package parameters populated from the environment variables fail validation, with a message that the 'expression cannot be parsed'.

I saw a mention somewhere that environment variables cannot be referenced by package variables. Is this the case? If so what would be the best method to pass the folder paths to the package variables?

Thanks

Environment variables pass values to parameters, which are then read-only throughout package execution.
Package variables can reference the values of parameters (as passed in from an environment variable), no problem.
Does that help at all?



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
tim.ffitch 25252
tim.ffitch 25252
Right there with Babe
Right there with Babe (782 reputation)Right there with Babe (782 reputation)Right there with Babe (782 reputation)Right there with Babe (782 reputation)Right there with Babe (782 reputation)Right there with Babe (782 reputation)Right there with Babe (782 reputation)Right there with Babe (782 reputation)

Group: General Forum Members
Points: 782 Visits: 152
slimchance99 - Monday, February 5, 2018 2:08 PM
I have a package where network file paths are set up as package parameters, and these parameters are referenced in package variables that concatenate with file names read from file enumeration loops. Something like @[$Package::parWorkingFIlePath] + @[User::usrXMLFileNamePath]

Everything works fine in VS. My deployment plan was to use environment variables to read in the testing/production file paths from environment variables to the parameters on the server. On the server all of the variables that reference the package parameters populated from the environment variables fail validation, with a message that the 'expression cannot be parsed'.

I saw a mention somewhere that environment variables cannot be referenced by package variables. Is this the case? If so what would be the best method to pass the folder paths to the package variables?

Thanks

If you are using SQL Server 2012 onward I would suggest you research Project Deployment where you can set parameters in the SSIS Catalog for each server the project is deployed to. If you know how to set up configurations in Visual Studio your configuration values and paths etc can be configured in Visual Studio and deployed along with your project. To ease development and deployment make sure you use the security setting Don't Save Sensitive on all of the packages and the project. You then need to set sensitive values in the SSIS catalog post deployment. That way you don't need to mess around with Environment Variables and Configuration Files.

Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)

Group: General Forum Members
Points: 137525 Visits: 22866
tim.ffitch 25252 - Tuesday, February 6, 2018 6:44 AM
slimchance99 - Monday, February 5, 2018 2:08 PM
I have a package where network file paths are set up as package parameters, and these parameters are referenced in package variables that concatenate with file names read from file enumeration loops. Something like @[$Package::parWorkingFIlePath] + @[User::usrXMLFileNamePath]

Everything works fine in VS. My deployment plan was to use environment variables to read in the testing/production file paths from environment variables to the parameters on the server. On the server all of the variables that reference the package parameters populated from the environment variables fail validation, with a message that the 'expression cannot be parsed'.

I saw a mention somewhere that environment variables cannot be referenced by package variables. Is this the case? If so what would be the best method to pass the folder paths to the package variables?

Thanks

If you are using SQL Server 2012 onward I would suggest you research Project Deployment where you can set parameters in the SSIS Catalog for each server the project is deployed to. If you know how to set up configurations in Visual Studio your configuration values and paths etc can be configured in Visual Studio and deployed along with your project. To ease development and deployment make sure you use the security setting Don't Save Sensitive on all of the packages and the project. You then need to set sensitive values in the SSIS catalog post deployment. That way you don't need to mess around with Environment Variables and Configuration Files.

Aha, my post was referring to Environment Variables in SSISDB, not to DOS variables.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
slimchance99
slimchance99
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1724 Visits: 252
Phil Parkin - Monday, February 5, 2018 2:43 PM
slimchance99 - Monday, February 5, 2018 2:08 PM
I have a package where network file paths are set up as package parameters, and these parameters are referenced in package variables that concatenate with file names read from file enumeration loops. Something like @[$Package::parWorkingFIlePath] + @[User::usrXMLFileNamePath]

Everything works fine in VS. My deployment plan was to use environment variables to read in the testing/production file paths from environment variables to the parameters on the server. On the server all of the variables that reference the package parameters populated from the environment variables fail validation, with a message that the 'expression cannot be parsed'.

I saw a mention somewhere that environment variables cannot be referenced by package variables. Is this the case? If so what would be the best method to pass the folder paths to the package variables?

Thanks

Environment variables pass values to parameters, which are then read-only throughout package execution.
Package variables can reference the values of parameters (as passed in from an environment variable), no problem.
Does that help at all?

That is my understanding, and that is how the packages are built. but for some reason all of my package variables that reference the parameters show validation errors on the server (no problem in VS)

thanks




Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)

Group: General Forum Members
Points: 137525 Visits: 22866
slimchance99 - Tuesday, February 6, 2018 7:06 AM
Phil Parkin - Monday, February 5, 2018 2:43 PM
slimchance99 - Monday, February 5, 2018 2:08 PM
I have a package where network file paths are set up as package parameters, and these parameters are referenced in package variables that concatenate with file names read from file enumeration loops. Something like @[$Package::parWorkingFIlePath] + @[User::usrXMLFileNamePath]

Everything works fine in VS. My deployment plan was to use environment variables to read in the testing/production file paths from environment variables to the parameters on the server. On the server all of the variables that reference the package parameters populated from the environment variables fail validation, with a message that the 'expression cannot be parsed'.

I saw a mention somewhere that environment variables cannot be referenced by package variables. Is this the case? If so what would be the best method to pass the folder paths to the package variables?

Thanks

Environment variables pass values to parameters, which are then read-only throughout package execution.
Package variables can reference the values of parameters (as passed in from an environment variable), no problem.
Does that help at all?

That is my understanding, and that is how the packages are built. but for some reason all of my package variables that reference the parameters show validation errors on the server (no problem in VS)

thanks

SSDT does not use SSISDB environment variables, if you are referring to 'Debug' mode.
Did you double check that
a) The correct environment has been mapped to the correct project (using 'Configure'), and
b) That the variable mappings have been made correctly (also using 'Configure'), and
c) That the SQL Agent job running the package is configured to select the correct environment (on the 'Configuration' tab, while in 'Edit Step').



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
slimchance99
slimchance99
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1724 Visits: 252
Phil Parkin - Tuesday, February 6, 2018 7:13 AM
slimchance99 - Tuesday, February 6, 2018 7:06 AM
Phil Parkin - Monday, February 5, 2018 2:43 PM
slimchance99 - Monday, February 5, 2018 2:08 PM
I have a package where network file paths are set up as package parameters, and these parameters are referenced in package variables that concatenate with file names read from file enumeration loops. Something like @[$Package::parWorkingFIlePath] + @[User::usrXMLFileNamePath]

Everything works fine in VS. My deployment plan was to use environment variables to read in the testing/production file paths from environment variables to the parameters on the server. On the server all of the variables that reference the package parameters populated from the environment variables fail validation, with a message that the 'expression cannot be parsed'.

I saw a mention somewhere that environment variables cannot be referenced by package variables. Is this the case? If so what would be the best method to pass the folder paths to the package variables?

Thanks

Environment variables pass values to parameters, which are then read-only throughout package execution.
Package variables can reference the values of parameters (as passed in from an environment variable), no problem.
Does that help at all?

That is my understanding, and that is how the packages are built. but for some reason all of my package variables that reference the parameters show validation errors on the server (no problem in VS)

thanks

SSDT does not use SSISDB environment variables, if you are referring to 'Debug' mode.
Did you double check that
a) The correct environment has been mapped to the correct project (using 'Configure'), and
b) That the variable mappings have been made correctly (also using 'Configure'), and
c) That the SQL Agent job running the package is configured to select the correct environment (on the 'Configuration' tab, while in 'Edit Step').

a,b and c - all checked and double checked. I've deployed numerous projects to this server previously using the same method with no issue, so this one has me scratching my head a bit. Thanks for weighing in.




Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)

Group: General Forum Members
Points: 137525 Visits: 22866
Hmm, OK.
Where, exactly, are you seeing this message?
..., with a message that the 'expression cannot be parsed'.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
slimchance99
slimchance99
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1724 Visits: 252
Phil Parkin - Tuesday, February 6, 2018 9:05 AM
repHmm, OK.
Where, exactly, are you seeing this message?
..., with a message that the 'expression cannot be parsed'.

Show up on the server execution report for the package. See attached...




Attachments
Capture.PNG (8 views, 6.00 KB)
Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)SSC Guru (137K reputation)

Group: General Forum Members
Points: 137525 Visits: 22866
OK, this is getting tough Smile

Are any of the parameters marked as Sensitive?

Can you confirm from the All Executions reports that the values of the parameters are correctly being passed to the package at runtime?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search