Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to Use package variable in Execute SQL task Expand / Collapse
Author
Message
Posted Tuesday, November 2, 2010 8:21 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, September 25, 2014 3:36 AM
Points: 1,063, Visits: 709
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
Post #1014534
Posted Tuesday, November 2, 2010 8:34 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:34 AM
Points: 5,111, Visits: 11,915
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.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1014554
Posted Tuesday, November 2, 2010 10:47 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, September 25, 2014 3:36 AM
Points: 1,063, Visits: 709
http://blogs.techrepublic.com.com/datacenter/?p=237

This link solved my problem
Post #1014678
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse