CREATE PROCEDURE dbo.InsertUpdateHistoryWithTr
(@Id varchar(50),
@DPId varchar(50),
@EffectiveDate varchar(50),
@DP_New varchar(50),
@DP_Old varchar(50),
@UpdateType varchar(50))
AS
BEGIN
DECLARE @sql varchar(800)
SET @sql = 'If ((' + @DP_New + '<>' + @DP_Old +'OR ((' + @DP_New + 'is Null) and (' + @DP_New + 'is Not Null)))'+
'Insert UpdateHistory_N(Id,TS,DPId,EffectiveDate,DataValueNew,DataValueOld,UpdateType)
Values (' + @Id +',getdate(),' + @DPId + ',' + @EffectiveDate + ',' +
@DP_New + ',' + @DP_Old +',' + @UpdateType + ')'
EXEC (@sql)
END在执行这个存储过程的时候,程序报错说没有提供@UpdateType,是不是执行语句的语法有错误?Procedure or function 'InsertUpdateHistoryWithTr' expects parameter '@UpdateType', which was not supplied.执行语句如下:
EXEC InsertUpdateHistoryWithTr @Id='SS00000009',@DPId='DR99',@EffectiveDate='2000-00-00',@DP_New='0.00000',@DP_Old='0.00000',@UpdateTpye='1'
(@Id varchar(50),
@DPId varchar(50),
@EffectiveDate varchar(50),
@DP_New varchar(50),
@DP_Old varchar(50),
@UpdateType varchar(50))
AS
BEGIN
DECLARE @sql varchar(800)
SET @sql = 'If ((' + @DP_New + '<>' + @DP_Old +'OR ((' + @DP_New + 'is Null) and (' + @DP_New + 'is Not Null)))'+
'Insert UpdateHistory_N(Id,TS,DPId,EffectiveDate,DataValueNew,DataValueOld,UpdateType)
Values (' + @Id +',getdate(),' + @DPId + ',' + @EffectiveDate + ',' +
@DP_New + ',' + @DP_Old +',' + @UpdateType + ')'
EXEC (@sql)
END在执行这个存储过程的时候,程序报错说没有提供@UpdateType,是不是执行语句的语法有错误?Procedure or function 'InsertUpdateHistoryWithTr' expects parameter '@UpdateType', which was not supplied.执行语句如下:
EXEC InsertUpdateHistoryWithTr @Id='SS00000009',@DPId='DR99',@EffectiveDate='2000-00-00',@DP_New='0.00000',@DP_Old='0.00000',@UpdateTpye='1'
大哥是 @UpdateType 不是 @UpdateTpye
(@Id varchar(50),
@DPId varchar(50),
@EffectiveDate varchar(50),
@DP_New varchar(50),
@DP_Old varchar(50),
@UpdateType varchar(50))
AS
BEGIN
DECLARE @sql varchar(800)
if ((@DP_New<>@DP_Old) or ((@DP_New is null) and (@DP_New is not null)) )
begin SET @sql ='Insert UpdateHistory_N(Id,TS,DPId,EffectiveDate,DataValueNew,DataValueOld,UpdateType) ' +
'Values (''' + @Id +''',getdate(),''' + @DPId +''',''' + @EffectiveDate + ''',' + @DP_New + ',' + @DP_Old +',' + @UpdateType + ')' EXEC (@sql)
end
END