如何寫下面更新查詢在SSIS:如何寫case語句更新詢問在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= ?
得到錯誤而寫,請建議..
什麼問題?當然,您可以將該代碼粘貼到SSIS包中的Appopriate Task對象中?你問是使用哪個任務? – nurdglaw
我在寫這樣的查詢: UPDATE sacceomer SET salesamt1 = CASE WHEN(@ janfl ='y')THEN? ELSE salesamt1 END, salesamt2 = CASE WHEN(@ janfl ='y')THEN? ELSE salesamt2 END, salesamt3 = CASE WHEN(@ janfl ='y')THEN? ELSE salesamt3 END WHERE cono =? 和yr =? 和divno =? 和whse =? 和custno =? – Elliana
但給錯誤,我不太瞭解SSIS,但需要寫上面的查詢SSIS ..請幫助。 [用高級編輯來寫更新記錄]。 – Elliana