SQlserver触发器例子trigger
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
-- 创建触发器
create TRIGGER AddData
on [Time]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
-- 声明数据表中的字段变量
declare @TimeStamp datetime
declare @MDepth real
declare @BDepth real
declare @VDepth real
declare @BlockHeight real
declare @BlockSpeed real
declare @ROP real
declare @WOB real
declare @aRPM real
declare @RotaryFreq real
declare @RotaryCounts real
declare @RotaryFreqBit real
declare @RotaryCountsBit real
declare @RotaryFreqTotal real
declare @RotaryCountsTotal real
declare @HookLoad real
declare @HookLoad_Min real
declare @HookLoad_Max real
declare @HookLoad_Avg real
declare @SPP real
declare @SPP_Min real
declare @SPP_Max real
declare @SPP_Avg real
declare @RTorque real
declare @RTorque_Min real
declare @RTorque_Max real
declare @RTorque_Avg real
declare @CasingPr real
declare @ChokePr real
declare @RigHeave real
declare @TideComp real
declare @Pump_1_Freq real
declare @Pump_1_Counts real
declare @Pump_1_Flow real
declare @Pump_2_Freq real
declare @Pump_2_Counts real
declare @Pump_2_Flow real
declare @Pump_3_Freq real
declare @Pump_3_Counts real
declare @Pump_3_Flow real
declare @Pump_4_Freq real
declare @Pump_4_Counts real
declare @Pump_4_Flow real
declare @Pump_ToHole_Freq real
declare @Pump_ToHole_Counts real
declare @TotalStrokes real
declare @CumVolumePumpedToBit real
declare @CumVolumePumpedToRiser real
declare @CumVolumePumpedToMudCap real
declare @CumVolumePumpedToNone real
declare @MFInToBit real
declare @MFInToRiser real
declare @MFInToMudCap real
declare @MFInToNone real
declare @Pit_1_Volume real
declare @Pit_2_Volume real
declare @Pit_3_Volume real
declare @Pit_4_Volume real
declare @Pit_5_Volume real
declare @Pit_6_Volume real
declare @Pit_7_Volume real
declare @Pit_8_Volume real
declare @Pit_9_Volume real
declare @Pit_10_Volume real
declare @Pit_11_Volume real
declare @Pit_12_Volume real
declare @Pit_Active_Volume real
declare @Pit_Trip_Volume real
declare @Pit_Slug_Volume real
declare @PVT real
declare @Pit_Active_GL real
declare @Pit_Trip_GL real
declare @MFOut real
declare @TempIn real
declare @TempOut real
declare @MWIn real
declare @MWOut real
declare @CondIn real
declare @CondOut real
declare @BitTimeDrill real
declare @BitTimeTotal real
declare @BitTotalDrilled real
declare @MFInToHole real
declare @TotalGas real
declare @irCH4 real
declare @Amb_Gas_01 real
declare @Amb_Gas_02 real
declare @Amb_Gas_03 real
declare @Amb_Gas_04 real
declare @Amb_Gas_05 real
declare @Amb_Gas_06 real
declare @C1 real
declare @C2 real
declare @C3 real
declare @iC4 real
declare @nC4 real
declare @iC5 real
declare @nC5 real
declare @Acetylene real
declare @ChromStartTime datetime
declare @CO2 real
declare @H2S real
declare @LagDepth real
declare @ECD real
declare @Swurge real
declare @MSE real
declare @ExpPVT real
declare @ExpHookLoad real
declare @TonMiles real
declare @Activity real
declare @Synch int
declare @SpareLag1 real
declare @SpareLag2 real
declare @SpareLag3 real
declare @Spare1 real
declare @Spare2 real
declare @Spare3 real
declare @PPG real
declare @CircTime real
declare @dcExp real
declare @KillPr real
declare @ROPMinperIntvl real
declare @CementPR real
declare @DiffSPP real
declare @TotalGas_Max real
declare @PVTDiff real
declare @Pit_13_Volume real
declare @Pit_14_Volume real
declare @Pit_15_Volume real
declare @Pit_16_Volume real
declare @Pit_17_Volume real
declare @Pit_18_Volume real
declare @Pit_19_Volume real
declare @Pit_20_Volume real
declare @PWDEMW real
declare @PWDEMWPOMin real
declare @PWDEMWPOMax real
declare @FlowDiff real
declare @C1z real
declare @C2z real
declare @C3z real
declare @iC4z real
declare @nC4z real
declare @iC5z real
declare @nC5z real
declare @aMFIn real
declare @ExpMFOut real
declare @FlowInDiff real
declare @MPDPr real
declare @Circulating int
declare @Rotating int
declare @OnSlips int
declare @C6 real
declare @Benzene real
declare @C7 real
declare @Toluene real
declare @C8 real
-- 声明其他中间变量,包括输出字符串变量@DataStr
declare @err int, @obj int, @a int
declare @DataStr varchar(8000)
-- 生成查询新增数据的sql语句
select
@TimeStamp=TimeStamp,
@MDepth=MDepth,
@BDepth=BDepth,
@VDepth=VDepth,
@BlockHeight=BlockHeight,
@BlockSpeed=BlockSpeed,
@ROP=ROP,
@WOB=WOB,
@aRPM=aRPM,
@RotaryFreq=RotaryFreq,
@RotaryCounts=RotaryCounts,
@RotaryFreqBit=RotaryFreqBit,
@RotaryCountsBit=RotaryCountsBit,
@RotaryFreqTotal=RotaryFreqTotal,
@RotaryCountsTotal=RotaryCountsTotal,
@HookLoad=HookLoad,
@HookLoad_Min=HookLoad_Min,
@HookLoad_Max=HookLoad_Max,
@HookLoad_Avg=HookLoad_Avg,
@SPP=SPP,
@SPP_Min=SPP_Min,
@SPP_Max=SPP_Max,
@SPP_Avg=SPP_Avg,
@RTorque=RTorque,
@RTorque_Min=RTorque_Min,
@RTorque_Max=RTorque_Max,
@RTorque_Avg=RTorque_Avg,
@CasingPr=CasingPr,
@ChokePr=ChokePr,
@RigHeave=RigHeave,
@TideComp=TideComp,
@Pump_1_Freq=Pump_1_Freq,
@Pump_1_Counts=Pump_1_Counts,
@Pump_1_Flow=Pump_1_Flow,
@Pump_2_Freq=Pump_2_Freq,
@Pump_2_Counts=Pump_2_Counts,
@Pump_2_Flow=Pump_2_Flow,
@Pump_3_Freq=Pump_3_Freq,
@Pump_3_Counts=Pump_3_Counts,
@Pump_3_Flow=Pump_3_Flow,
@Pump_4_Freq=Pump_4_Freq,
@Pump_4_Counts=Pump_4_Counts,
@Pump_4_Flow=Pump_4_Flow,
@Pump_ToHole_Freq=Pump_ToHole_Freq,
@Pump_ToHole_Counts=Pump_ToHole_Counts,
@TotalStrokes=TotalStrokes,
@CumVolumePumpedToBit=CumVolumePumpedToBit,
@CumVolumePumpedToRiser=CumVolumePumpedToRiser,
@CumVolumePumpedToMudCap=CumVolumePumpedToMudCap,
@CumVolumePumpedToNone=CumVolumePumpedToNone,
@MFInToBit=MFInToBit,
@MFInToRiser=MFInToRiser,
@MFInToMudCap=MFInToMudCap,
@MFInToNone=MFInToNone,
@Pit_1_Volume=Pit_1_Volume,
@Pit_2
_Volume=Pit_2_Volume,
@Pit_3_Volume=Pit_3_Volume,
@Pit_4_Volume=Pit_4_Volume,
@Pit_5_Volume=Pit_5_Volume,
@Pit_6_Volume=Pit_6_Volume,
@Pit_7_Volume=Pit_7_Volume,
@Pit_8_Volume=Pit_8_Volume,
@Pit_9_Volume=Pit_9_Volume,
@Pit_10_Volume=Pit_10_Volume,
@Pit_11_Volume=Pit_11_Volume,
@Pit_12_Volume=Pit_12_Volume,
@Pit_Active_Volume=Pit_Active_Volume,
@Pit_Trip_Volume=Pit_Trip_Volume,
@Pit_Slug_Volume=Pit_Slug_Volume,
@PVT=PVT,
@Pit_Active_GL=Pit_Active_GL,
@Pit_Trip_GL=Pit_Trip_GL,
@MFOut=MFOut,
@TempIn=TempIn,
@TempOut=TempOut,
@MWIn=MWIn,
@MWOut=MWOut,
@CondIn=CondIn,
@CondOut=CondOut,
@BitTimeDrill=BitTimeDrill,
@BitTimeTotal=BitTimeTotal,
@BitTotalDrilled=BitTotalDrilled,
@MFInToHole=MFInToHole,
@TotalGas=TotalGas,
@irCH4=irCH4,
@Amb_Gas_01=Amb_Gas_01,
@Amb_Gas_02=Amb_Gas_02,
@Amb_Gas_03=Amb_Gas_03,
@Amb_Gas_04=Amb_Gas_04,
@Amb_Gas_05=Amb_Gas_05,
@Amb_Gas_06=Amb_Gas_06,
@C1=C1,
@C2=C2,
@C3=C3,
@iC4=iC4,
@nC4=nC4,
@iC5=iC5,
@nC5=nC5,
@Acetylene=Acetylene,
@ChromStartTime=ChromStartTime,
@CO2=CO2,
@H2S=H2S,
@LagDepth=LagDepth,
@ECD=ECD,
@Swurge=Swurge,
@MSE=MSE,
@ExpPVT=ExpPVT,
@ExpHookLoad=ExpHookLoad,
@TonMiles=TonMiles,
@Activity=Activity,
@Synch=Synch,
@SpareLag1=SpareLag1,
@SpareLag2=SpareLag2,
@SpareLag3=SpareLag3,
@Spare1=Spare1,
@Spare2=Spare2,
@Spare3=Spare3,
@PPG=PPG,
@CircTime=CircTime,
@dcExp=dcExp,
@KillPr=KillPr,
@ROPMinperIntvl=ROPMinperIntvl,
@CementPR=CementPR,
@DiffSPP=DiffSPP,
@TotalGas_Max=TotalGas_Max,
@PVTDiff=PVTDiff,
@Pit_13_Volume=Pit_13_Volume,
@Pit_14_Volume=Pit_14_Volume,
@Pit_15_Volume=Pit_15_Volume,
@Pit_16_Volume=Pit_16_Volume,
@Pit_17_Volume=Pit_17_Volume,
@Pit_18_Volume=Pit_18_Volume,
@Pit_19_Volume=Pit_19_Volume,
@Pit_20_Volume=Pit_20_Volume,
@PWDEMW=PWDEMW,
@PWDEMWPOMin=PWDEMWPOMin,
@PWDEMWPOMax=PWDEMWPOMax,
@FlowDiff=FlowDiff,
@C1z=C1z,
@C2z=C2z,
@C3z=C3z,
@iC4z=iC4z,
@nC4z=nC4z,
@iC5z=iC5z,
@nC5z=nC5z,
@aMFIn=aMFIn,
@ExpMFOut=ExpMFOut,
@FlowInDiff=FlowInDiff,
@MPDPr=MPDPr,
@Circulating=Circulating,
@Rotating=Rotating,
@OnSlips=OnSlips,
@C6=C6,
@Benzene=Benzene,
@C7=C7,
@Toluene=Toluene,
@C8=C8
from inserted
-- 生成外传字符串语句
set @DataStr = 'TimeStamp=' + convert(varchar, convert(decimal(16,8),@TimeStamp) )
set @DataStr = @DataStr + ',MDepth=' + convert(varchar, convert(decimal(16,8),@MDepth) )
set @DataStr = @DataStr + ',BDepth=' + convert(varchar, convert(decimal(16,8),@BDepth) )
set @DataStr = @DataStr + ',VDepth=' + convert(varchar, convert(decimal(16,8),@VDepth) )
set @DataStr = @DataStr + ',BlockHeight=' + convert(varchar, convert(decimal(16,8),@BlockHeight) )
set @DataStr = @DataStr + ',BlockSpeed=' + convert(varchar, convert(decimal(16,8),@BlockSpeed) )
set @DataStr = @DataStr + ',ROP=' + convert(varchar, convert(decimal(16,8),@ROP) )
set @DataStr = @DataStr + ',WOB=' + conv
ert(varchar, convert(decimal(16,8),@WOB) )
set @DataStr = @DataStr + ',aRPM=' + convert(varchar, convert(decimal(16,8),@aRPM) )
set @DataStr = @DataStr + ',RotaryFreq=' + convert(varchar, convert(decimal(16,8),@RotaryFreq) )
set @DataStr = @DataStr + ',RotaryCounts=' + convert(varchar, convert(decimal(16,8),@RotaryCounts) )
set @DataStr = @DataStr + ',RotaryFreqBit=' + convert(varchar, convert(decimal(16,8),@RotaryFreqBit) )
set @DataStr = @DataStr + ',RotaryCountsBit=' + convert(varchar, convert(decimal(16,8),@RotaryCountsBit) )
set @DataStr = @DataStr + ',RotaryFreqTotal=' + convert(varchar, convert(decimal(16,8),@RotaryFreqTotal) )
set @DataStr = @DataStr + ',RotaryCountsTotal=' + convert(varchar, convert(decimal(16,8),@RotaryCountsTotal) )
set @DataStr = @DataStr + ',HookLoad=' + convert(varchar, convert(decimal(16,8),@HookLoad) )
set @DataStr = @DataStr + ',HookLoad_Min=' + convert(varchar, convert(decimal(16,8),@HookLoad_Min) )
set @DataStr = @DataStr + ',HookLoad_Max=' + convert(varchar, convert(decimal(16,8),@HookLoad_Max) )
set @DataStr = @DataStr + ',HookLoad_Avg=' + convert(varchar, convert(decimal(16,8),@HookLoad_Avg) )
set @DataStr = @DataStr + ',SPP=' + convert(varchar, convert(decimal(16,8),@SPP) )
set @DataStr = @DataStr + ',SPP_Min=' + convert(varchar, convert(decimal(16,8),@SPP_Min) )
set @DataStr = @DataStr + ',SPP_Max=' + convert(varchar, convert(decimal(16,8),@SPP_Max) )
set @DataStr = @DataStr + ',SPP_Avg=' + convert(varchar, convert(decimal(16,8),@SPP_Avg) )
set @DataStr = @DataStr + ',RTorque=' + convert(varchar, convert(decimal(16,8),@RTorque) )
set @DataStr = @DataStr + ',RTorque_Min=' + convert(varchar, convert(decimal(16,8),@RTorque_Min) )
set @DataStr = @DataStr + ',RTorque_Max=' + convert(varchar, convert(decimal(16,8),@RTorque_Max) )
set @DataStr = @DataStr + ',RTorque_Avg=' + convert(varchar, convert(decimal(16,8),@RTorque_Avg) )
set @DataStr = @DataStr + ',CasingPr=' + convert(varchar, convert(decimal(16,8),@CasingPr) )
set @DataStr = @DataStr + ',ChokePr=' + convert(varchar, convert(decimal(16,8),@ChokePr) )
set @DataStr = @DataStr + ',RigHeave=' + convert(varchar, convert(decimal(16,8),@RigHeave) )
set @DataStr = @DataStr + ',TideComp=' + convert(varchar, convert(decimal(16,8),@TideComp) )
set @DataStr = @DataStr + ',Pump_1_Freq=' + convert(varchar, convert(decimal(16,8),@Pump_1_Freq) )
set @DataStr = @DataStr + ',Pump_1_Counts=' + convert(varchar, convert(decimal(16,8),@Pump_1_Counts) )
set @DataStr = @DataStr + ',Pump_1_Flow=' + convert(varchar, convert(decimal(16,8),@Pump_1_Flow) )
set @DataStr = @DataStr + ',Pump_2_Freq=' + convert(varchar, convert(decimal(16,8),@Pump_2_Freq) )
set @DataStr = @DataStr + ',Pump_2_Counts=' + convert(varchar, convert(decimal(16,8),@Pump_2_Counts) )
set @DataStr = @DataStr + ',Pump_2_Flow=' + convert(varchar, convert(decimal(16,8),@Pump_2_Flow) )
set @DataStr = @DataStr + ',Pump_3_Freq=' + convert(varchar, convert(decim
al(16,8),@Pump_3_Freq) )
set @DataStr = @DataStr + ',Pump_3_Counts=' + convert(varchar, convert(decimal(16,8),@Pump_3_Counts) )
set @DataStr = @DataStr + ',Pump_3_Flow=' + convert(varchar, convert(decimal(16,8),@Pump_3_Flow) )
set @DataStr = @DataStr + ',Pump_4_Freq=' + convert(varchar, convert(decimal(16,8),@Pump_4_Freq) )
set @DataStr = @DataStr + ',Pump_4_Counts=' + convert(varchar, convert(decimal(16,8),@Pump_4_Counts) )
set @DataStr = @DataStr + ',Pump_4_Flow=' + convert(varchar, convert(decimal(16,8),@Pump_4_Flow) )
set @DataStr = @DataStr + ',Pump_ToHole_Freq=' + convert(varchar, convert(decimal(16,8),@Pump_ToHole_Freq) )
set @DataStr = @DataStr + ',Pump_ToHole_Counts=' + convert(varchar, convert(decimal(16,8),@Pump_ToHole_Counts) )
set @DataStr = @DataStr + ',TotalStrokes=' + convert(varchar, convert(decimal(16,8),@TotalStrokes) )
set @DataStr = @DataStr + ',CumVolumePumpedToBit=' + convert(varchar, convert(decimal(16,8),@CumVolumePumpedToBit) )
set @DataStr = @DataStr + ',CumVolumePumpedToRiser=' + convert(varchar, convert(decimal(16,8),@CumVolumePumpedToRiser) )
set @DataStr = @DataStr + ',CumVolumePumpedToMudCap=' + convert(varchar, convert(decimal(16,8),@CumVolumePumpedToMudCap) )
set @DataStr = @DataStr + ',CumVolumePumpedToNone=' + convert(varchar, convert(decimal(16,8),@CumVolumePumpedToNone) )
set @DataStr = @DataStr + ',MFInToBit=' + convert(varchar, convert(decimal(16,8),@MFInToBit) )
set @DataStr = @DataStr + ',MFInToRiser=' + convert(varchar, convert(decimal(16,8),@MFInToRiser) )
set @DataStr = @DataStr + ',MFInToMudCap=' + convert(varchar, convert(decimal(16,8),@MFInToMudCap) )
set @DataStr = @DataStr + ',MFInToNone=' + convert(varchar, convert(decimal(16,8),@MFInToNone) )
set @DataStr = @DataStr + ',Pit_1_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_1_Volume) )
set @DataStr = @DataStr + ',Pit_2_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_2_Volume) )
set @DataStr = @DataStr + ',Pit_3_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_3_Volume) )
set @DataStr = @DataStr + ',Pit_4_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_4_Volume) )
set @DataStr = @DataStr + ',Pit_5_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_5_Volume) )
set @DataStr = @DataStr + ',Pit_6_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_6_Volume) )
set @DataStr = @DataStr + ',Pit_7_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_7_Volume) )
set @DataStr = @DataStr + ',Pit_8_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_8_Volume) )
set @DataStr = @DataStr + ',Pit_9_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_9_Volume) )
set @DataStr = @DataStr + ',Pit_10_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_10_Volume) )
set @DataStr = @DataStr + ',Pit_11_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_11_Volume) )
set @DataStr = @DataStr + ',Pit_12_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_12_Volume) )
s
et @DataStr = @DataStr + ',Pit_Active_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_Active_Volume) )
set @DataStr = @DataStr + ',Pit_Trip_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_Trip_Volume) )
set @DataStr = @DataStr + ',Pit_Slug_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_Slug_Volume) )
set @DataStr = @DataStr + ',PVT=' + convert(varchar, convert(decimal(16,8),@PVT) )
set @DataStr = @DataStr + ',Pit_Active_GL=' + convert(varchar, convert(decimal(16,8),@Pit_Active_GL) )
set @DataStr = @DataStr + ',Pit_Trip_GL=' + convert(varchar, convert(decimal(16,8),@Pit_Trip_GL) )
set @DataStr = @DataStr + ',MFOut=' + convert(varchar, convert(decimal(16,8),@MFOut) )
set @DataStr = @DataStr + ',TempIn=' + convert(varchar, convert(decimal(16,8),@TempIn) )
set @DataStr = @DataStr + ',TempOut=' + convert(varchar, convert(decimal(16,8),@TempOut) )
set @DataStr = @DataStr + ',MWIn=' + convert(varchar, convert(decimal(16,8),@MWIn) )
set @DataStr = @DataStr + ',MWOut=' + convert(varchar, convert(decimal(16,8),@MWOut) )
set @DataStr = @DataStr + ',CondIn=' + convert(varchar, convert(decimal(16,8),@CondIn) )
set @DataStr = @DataStr + ',CondOut=' + convert(varchar, convert(decimal(16,8),@CondOut) )
set @DataStr = @DataStr + ',BitTimeDrill=' + convert(varchar, convert(decimal(16,8),@BitTimeDrill) )
set @DataStr = @DataStr + ',BitTimeTotal=' + convert(varchar, convert(decimal(16,8),@BitTimeTotal) )
set @DataStr = @DataStr + ',BitTotalDrilled=' + convert(varchar, convert(decimal(16,8),@BitTotalDrilled) )
set @DataStr = @DataStr + ',MFInToHole=' + convert(varchar, convert(decimal(16,8),@MFInToHole) )
set @DataStr = @DataStr + ',TotalGas=' + convert(varchar, convert(decimal(16,8),@TotalGas) )
set @DataStr = @DataStr + ',irCH4=' + convert(varchar, convert(decimal(16,8),@irCH4) )
set @DataStr = @DataStr + ',Amb_Gas_01=' + convert(varchar, convert(decimal(16,8),@Amb_Gas_01) )
set @DataStr = @DataStr + ',Amb_Gas_02=' + convert(varchar, convert(decimal(16,8),@Amb_Gas_02) )
set @DataStr = @DataStr + ',Amb_Gas_03=' + convert(varchar, convert(decimal(16,8),@Amb_Gas_03) )
set @DataStr = @DataStr + ',Amb_Gas_04=' + convert(varchar, convert(decimal(16,8),@Amb_Gas_04) )
set @DataStr = @DataStr + ',Amb_Gas_05=' + convert(varchar, convert(decimal(16,8),@Amb_Gas_05) )
set @DataStr = @DataStr + ',Amb_Gas_06=' + convert(varchar, convert(decimal(16,8),@Amb_Gas_06) )
set @DataStr = @DataStr + ',C1=' + convert(varchar, convert(decimal(16,8),@C1) )
set @DataStr = @DataStr + ',C2=' + convert(varchar, convert(decimal(16,8),@C2) )
set @DataStr = @DataStr + ',C3=' + convert(varchar, convert(decimal(16,8),@C3) )
set @DataStr = @DataStr + ',iC4=' + convert(varchar, convert(decimal(16,8),@iC4) )
set @DataStr = @DataStr + ',nC4=' + convert(varchar, convert(decimal(16,8),@nC4) )
set @DataStr = @DataStr + ',iC5=' + convert(varchar, convert(decimal(16,8),@iC5) )
set @DataStr = @DataStr + ',nC5=' + convert(varcha
r, convert(decimal(16,8),@nC5) )
set @DataStr = @DataStr + ',Acetylene=' + convert(varchar, convert(decimal(16,8),@Acetylene) )
set @DataStr = @DataStr + ',ChromStartTime=' + convert(varchar, convert(decimal(16,8),@ChromStartTime) )
set @DataStr = @DataStr + ',CO2=' + convert(varchar, convert(decimal(16,8),@CO2) )
set @DataStr = @DataStr + ',H2S=' + convert(varchar, convert(decimal(16,8),@H2S) )
set @DataStr = @DataStr + ',LagDepth=' + convert(varchar, convert(decimal(16,8),@LagDepth) )
set @DataStr = @DataStr + ',ECD=' + convert(varchar, convert(decimal(16,8),@ECD) )
set @DataStr = @DataStr + ',Swurge=' + convert(varchar, convert(decimal(16,8),@Swurge) )
set @DataStr = @DataStr + ',MSE=' + convert(varchar, convert(decimal(16,8),@MSE) )
set @DataStr = @DataStr + ',ExpPVT=' + convert(varchar, convert(decimal(16,8),@ExpPVT) )
set @DataStr = @DataStr + ',ExpHookLoad=' + convert(varchar, convert(decimal(16,8),@ExpHookLoad) )
set @DataStr = @DataStr + ',TonMiles=' + convert(varchar, convert(decimal(16,8),@TonMiles) )
set @DataStr = @DataStr + ',Activity=' + convert(varchar, convert(decimal(16,8),@Activity) )
set @DataStr = @DataStr + ',Synch=' + convert(varchar, convert(decimal(16,8),@Synch) )
set @DataStr = @DataStr + ',SpareLag1=' + convert(varchar, convert(decimal(16,8),@SpareLag1) )
set @DataStr = @DataStr + ',SpareLag2=' + convert(varchar, convert(decimal(16,8),@SpareLag2) )
set @DataStr = @DataStr + ',SpareLag3=' + convert(varchar, convert(decimal(16,8),@SpareLag3) )
set @DataStr = @DataStr + ',Spare1=' + convert(varchar, convert(decimal(16,8),@Spare1) )
set @DataStr = @DataStr + ',Spare2=' + convert(varchar, convert(decimal(16,8),@Spare2) )
set @DataStr = @DataStr + ',Spare3=' + convert(varchar, convert(decimal(16,8),@Spare3) )
set @DataStr = @DataStr + ',PPG=' + convert(varchar, convert(decimal(16,8),@PPG) )
set @DataStr = @DataStr + ',CircTime=' + convert(varchar, convert(decimal(16,8),@CircTime) )
set @DataStr = @DataStr + ',dcExp=' + convert(varchar, convert(decimal(16,8),@dcExp) )
set @DataStr = @DataStr + ',KillPr=' + convert(varchar, convert(decimal(16,8),@KillPr) )
set @DataStr = @DataStr + ',ROPMinperIntvl=' + convert(varchar, convert(decimal(16,8),@ROPMinperIntvl) )
set @DataStr = @DataStr + ',CementPR=' + convert(varchar, convert(decimal(16,8),@CementPR) )
set @DataStr = @DataStr + ',DiffSPP=' + convert(varchar, convert(decimal(16,8),@DiffSPP) )
set @DataStr = @DataStr + ',TotalGas_Max=' + convert(varchar, convert(decimal(16,8),@TotalGas_Max) )
set @DataStr = @DataStr + ',PVTDiff=' + convert(varchar, convert(decimal(16,8),@PVTDiff) )
set @DataStr = @DataStr + ',Pit_13_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_13_Volume) )
set @DataStr = @DataStr + ',Pit_14_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_14_Volume) )
set @DataStr = @DataStr + ',Pit_15_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_15_Volume) )
set @DataStr = @DataStr + ',Pit_16
_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_16_Volume) )
set @DataStr = @DataStr + ',Pit_17_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_17_Volume) )
set @DataStr = @DataStr + ',Pit_18_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_18_Volume) )
set @DataStr = @DataStr + ',Pit_19_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_19_Volume) )
set @DataStr = @DataStr + ',Pit_20_Volume=' + convert(varchar, convert(decimal(16,8),@Pit_20_Volume) )
set @DataStr = @DataStr + ',PWDEMW=' + convert(varchar, convert(decimal(16,8),@PWDEMW) )
set @DataStr = @DataStr + ',PWDEMWPOMin=' + convert(varchar, convert(decimal(16,8),@PWDEMWPOMin) )
set @DataStr = @DataStr + ',PWDEMWPOMax=' + convert(varchar, convert(decimal(16,8),@PWDEMWPOMax) )
set @DataStr = @DataStr + ',FlowDiff=' + convert(varchar, convert(decimal(16,8),@FlowDiff) )
set @DataStr = @DataStr + ',C1z=' + convert(varchar, convert(decimal(16,8),@C1z) )
set @DataStr = @DataStr + ',C2z=' + convert(varchar, convert(decimal(16,8),@C2z) )
set @DataStr = @DataStr + ',C3z=' + convert(varchar, convert(decimal(16,8),@C3z) )
set @DataStr = @DataStr + ',iC4z=' + convert(varchar, convert(decimal(16,8),@iC4z) )
set @DataStr = @DataStr + ',nC4z=' + convert(varchar, convert(decimal(16,8),@nC4z) )
set @DataStr = @DataStr + ',iC5z=' + convert(varchar, convert(decimal(16,8),@iC5z) )
set @DataStr = @DataStr + ',nC5z=' + convert(varchar, convert(decimal(16,8),@nC5z) )
set @DataStr = @DataStr + ',aMFIn=' + convert(varchar, convert(decimal(16,8),@aMFIn) )
set @DataStr = @DataStr + ',ExpMFOut=' + convert(varchar, convert(decimal(16,8),@ExpMFOut) )
set @DataStr = @DataStr + ',FlowInDiff=' + convert(varchar, convert(decimal(16,8),@FlowInDiff) )
set @DataStr = @DataStr + ',MPDPr=' + convert(varchar, convert(decimal(16,8),@MPDPr) )
set @DataStr = @DataStr + ',Circulating=' + convert(varchar, convert(decimal(16,8),@Circulating) )
set @DataStr = @DataStr + ',Rotating=' + convert(varchar, convert(decimal(16,8),@Rotating) )
set @DataStr = @DataStr + ',OnSlips=' + convert(varchar, convert(decimal(16,8),@OnSlips) )
set @DataStr = @DataStr + ',C6=' + convert(varchar, convert(decimal(16,8),@C6) )
set @DataStr = @DataStr + ',Benzene=' + convert(varchar, convert(decimal(16,8),@Benzene) )
set @DataStr = @DataStr + ',C7=' + convert(varchar, convert(decimal(16,8),@C7) )
set @DataStr = @DataStr + ',Toluene=' + convert(varchar, convert(decimal(16,8),@Toluene) )
set @DataStr = @DataStr + ',C8=' + convert(varchar, convert(decimal(16,8),@C8) )
--创建调用实例
exec @err=sp_OACreate 'DataService.AddData', @obj out
--调用DLL中的函数
EXEC @err = sp_OAMethod @obj,'Add', @a out, @DataStr
-- 释放实例
exec sp_OADestroy @obj
END