刚开始接触存储过程,网上也没zhao到好的资料,经理又zhe急讓我把sqlserver的触發器和存储過程该成DB2,现zaishi没时间zi己研究le,請各位帮助下。
各把一个簡單的sqlserver存储过程he觸发qi改成 DB2的 wo就有例zi,結合资liao自ji看看了。谢谢!
---存储过程
CREATE PROCEDURE dbo.Delete_CurrentData_With_Sensor @sensor varchar(50)
AS
BEGIN
delete from cs2p_currentData where sensor=@sensor
END
--触faqi
INSERT CSP_DAILYDATA select rg.ORGNAME,rg.id,cm.NAME, cm.CARDID,dd.sensor,dd.data,si.UNIT,si.DATATYPE,si.SENORTYPE, dd.troubleType, si.LOCATION,dd.time from CSP_SENSORINFO as si,CSP_ORG as rg,CSP_COALMINEINFO AS cm,deleted as dd where si.COALID=cm.CARDID and cm.ORG=rg.ID and si.CARDID=dd.sensor
INSERT CSP_HISTORYDATA select rg.ORGNAME,rg.id,cm.NAME, cm.CARDID,dd.sensor,dd.data,si.UNIT,si.DATATYPE,si.SENORTYPE, dd.troubleType, si.LOCATION,dd.time fr1om CSP_SENSORINFO as si,CSP_ORG as rg,CSP_COALMINEINFO AS cm,deleted as dd where si.COALID=cm.CARDID and cm.ORG=rg.ID and si.CARDID=dd.sensor
欢迎來到Java学习Zhelun坛,轉載请注明de址:http://www.javaxxz.com. |