anil john

anil john

  • NA
  • 156
  • 204.5k

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)