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


How to Use package variable in Execute SQL task


How to Use package variable in Execute SQL task

Author
Message
Pulivarthi Sasidhar
Pulivarthi Sasidhar
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2004 Visits: 1026
hi All,

I want to use the variable in Execute sql task.

My script will return based on the Variable.

DECLARE @Env VARCHAR(5)
DECLARE @FilePath VARCHAR(500),@ToMail VARCHAR(500)

SET @Env=SSISVAriable
SELECT @FilePath=CASE @Env WHEN 'Dev' THEN '\\Dev\'
WHEN 'Test' THEN '\\Test\'
WHEN 'UAT' THEN '\\UAT\'
WHEN 'PrdSRV' THEN '\\PrdSRV\'
ELSE '\\share\' END,
@ToMail=CASE @Env WHEN 'Dev' THEN 'abcd@xyz.com'
WHEN 'Test' THEN 'abcd@xyz.com'
WHEN 'UAT' THEN 'abcd@xyz.com'
WHEN 'PrdSrv' THEN 'a2z@xyz.com;1to9@abc.com'
ELSE 'saasd@gmail.com' END

Exec proc_test @FilePath,@tomail

Please give steps or any link which will helpful.

Thanks,
Sasidhar Pulivarthi
Phil Parkin
Phil Parkin
SSC-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: General Forum Members
Points: 35245 Visits: 20869
To use SSIS variables within the Execute SQL task, use an Expression to set the appropriate property of the task.


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.
Pulivarthi Sasidhar
Pulivarthi Sasidhar
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2004 Visits: 1026
http://blogs.techrepublic.com.com/datacenter/?p=237

This link solved my problem
:-D
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