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 parameters in SSIS update query having CASE[ Giving Error] Expand / Collapse
Author
Message
Posted Tuesday, June 4, 2013 6:10 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, June 4, 2013 11:39 PM
Points: 50, Visits: 149
My below query is giving error while writing in query editor [ SSIS].


declare @janflag as varchar(56)
set @janflag ='y'
declare @febflag as varchar(56)
set @febflag ='y'/[ SELECT TOP 1 febfl FROM saupdate ]
* saupdate table in the control flow.


UPDATE sacustomer
SET salesamt1 = CASE WHEN (@janflag='y') THEN ? ELSE salesamt1 END ,
costamt1 = CASE WHEN (@janflag='y') THEN ? ELSE costamt1 END ,
qtysold1 = CASE WHEN (@janflag='y') THEN ? ELSE qtysold1 END ,

salesamt2 = CASE WHEN (@febflag ='y') THEN ? ELSE salesamt1 END ,
costamt2 = CASE WHEN (@febflag ='y') THEN ? ELSE costamt1 END ,
qtysold2 = CASE WHEN (@febflag ='y') THEN ? ELSE qtysold1 END

where cono=?
and yr=?
and divno= ?
and whse= ?
and custno= ?



Not sure about the declare code...

please check it and help me .

Thanks
Post #1459696
Posted Thursday, June 6, 2013 6:30 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, June 9, 2014 6:15 AM
Points: 79, Visits: 243
Try this

declare @janflag as varchar(56)
declare @febflag as varchar(56)
BEGIN
set @janflag ='y'

set @febflag ='y' --[ SELECT TOP 1 febfl FROM saupdate ]

<<ALLL your udpate statements here>>

End


Vikash Kumar Singh || www.singhvikash.in
Post #1460655
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse