这个INSERT存储过程有什么问题

时间:2014-01-07 08:26:13

标签: sql-server tsql stored-procedures

请在单个表'tblSOF'上看到SQL Server存储过程,这是一个简单的INSERT语句

CREATE PROCEDURE InsertINTO_tblSOF_sp
   @SOFID int, @ContractNo nvarchar(15), @SOFNo nvarchar(10), 
   @WONo int, @WORefType nvarchar(50), @WORef nvarchar(50), @InvoiceID int,
   @OrgCode nvarchar(50), @Sec nvarchar(50), @SOFDate datetime,
   @CommenceDate datetime, @LDPerDay money, @DurationDays int,
   @CompletionDate datetime, @TxtIncrmnt int, @TypeofWO nvarchar(50),
   @ActCompletionDate datetime, @DescriptionOfWork nvarchar(100), @Location nvarchar(50), 
   @Status nvarchar(50), @StatusDate datetime, @AccStringID int, @SOFValue money, 
   @LDApplied int, @PartialPayment bit, @Retention bit, @Percent money, 
   @LogRegID int, @RecordedBy nvarchar(50)
AS
BEGIN
   SET NOCOUNT ON;

   INSERT INTO [tblSOF]
 ([SOFID]
 ,[ContractNo]
 ,[SOFNo]
 ,[WONo]
 ,[WORefType]
 ,[WORef]
 ,[InvoiceID]
 ,[OrgCode]
 ,[Sec]
 ,[SOFDate]
 ,[CommenceDate]
 ,[LDPerDay]
 ,[DurationDays]
 ,[CompletionDate]
 ,[TxtIncrmnt]
 ,[TypeofWO]
 ,[ActCompletionDate]
 ,[DescriptionOfWork]
 ,[Location]
 ,[Status]
 ,[StatusDate]
 ,[AccStringID]
 ,[SOFValue]
 ,[LDApplied]
 ,[PartialPayment]
 ,[Retention]
 ,[Percent]
 ,[LogRegID]
 ,[RecordedBy])

 VALUES
 (@SOFID
 ,@ContractNo
 ,@SOFNo
 ,@WONo
 ,@WORefType
 ,@WORef
 ,@InvoiceID
 ,@OrgCode
 ,@Sec
 ,@SOFDate
 ,@CommenceDate
 ,@LDPerDay
 ,@DurationDays
 ,@CompletionDate
 ,@TxtIncrmnt
 ,@TypeofWO
 ,@ActCompletionDate
 ,@DescriptionOfWork
 ,@Location
 ,@Status
 ,@StatusDate
 ,@AccStringID
 ,@SOFValue
 ,@LDApplied
 ,@PartialPayment
 ,@Retention
 ,@Percent
 ,@LogRegID
 ,@RecordedBy)

GO

我对以下错误感到难过。

错误:

  

Msg 102,Level 15,State 1,Procedure InsertINTO_tblSOF_sp,第80行   ')'附近的语法不正确。

1 个答案:

答案 0 :(得分:5)

最后缺少END(您只有BEGIN):

...
,@RecordedBy)
END

GO