Mishal
Ten Centuries
Points: 1103
More actions
June 4, 2013 at 6:10 am
#273495
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= ?
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
Vikash Kumar Singh
SSC Eights!
Points: 974
June 6, 2013 at 6:30 am
#1621704
Try this
BEGIN
set @febflag ='y' --[ SELECT TOP 1 febfl FROM saupdate ]
<<ALLL your udpate statements here>>
End
Vikash Kumar Singh || www.singhvikash.in
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply