Forums - C# Corner

Forum guidelines
anil john

anil john

  • 1.2k
  • 147
  • 150.9k

Incorrect syntax near the keyword 'select'

Dec 17 2012 2:03 AM
Gtting h error:

Msg 156, Level 15, State 1, Procedure sp_DcPymentnsert, Line 16
Incorrect syntax near the keyword 'select'.
Msg 156, Level 15, State 1, Procedure sp_DcPymentnsert, Line 18
Incorrect syntax near the keyword 'select'.
Msg 156, Level 15, State 1, Procedure sp_DcPymentnsert, Line 20
Incorrect syntax near the keyword 'select'.

my pocedure

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:        Anil K John
-- Create date: 1/12/2012
-- Description:    Daily collection Payment
-- =============================================
CREATE PROCEDURE sp_DcPymentnsert
    (
    @iChitId int,
    @iRegId int,
    @fPaidAmount float,
    @dPaidate datetime
    )
AS
BEGIN
declare @fInstmount float
set @fInstmount=select fInstmount from tblChitInstalments where iChitId=@iChitId and iInstNo=(select max(iInstNo) from tblDCPayment where ichitId=@iChitId)   
declare @dInstDate datetime
set @dInstDate=select dInstDate from tblChitInstalments where iChitId=@iChitId and iInstNo=(select max(iInstNo) from tblDCPayment where ichitId=@iChitId)
declare @Balance float
set @Balance=select fInstmount-fPaidAmount from tblDCPayment where iChitId=@iChitId and iRegId=@iRegId
INSERT INTO tblDCPayment(iChitd,iRegId,iInstNo,fInstAmount,dInstDate,fPaidAmount,fBalance,dPaidDate)
VALUES(@iChitId,@iRegId,'1',@fInstmount,@dInstDate,@fPaidAmount,@Balance,@dPaidate)

END
GO


Answers (2)

Download Free eBooks

SPONSORED BY

File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!