anil john

anil john

  • NA
  • 156
  • 210.5k

Not getting values in insert satement

Dec 18 2012 5:05 AM
Plz help me its urgent;--

I am getting values  @fInstmount, @fInstmount in print staement but it wil not get in values field of insert statement


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


-- =============================================
-- Author:     Anil K John
-- Create date: 1/12/2012
-- Description:   Daily collection Payment
-- =============================================
ALTER PROCEDURE [dbo].[sp_DcPymentnsert]
   (
   @vChitName varchar(50),
   @iRegId int,
   @fPaidAmount float,
   @dPaidate datetime,
   @iChitId int
   --@Mode int
   )
AS
BEGIN
declare @iInstNo int
set @iInstNo=(select isnull(max(iInstNo),0)+1 from tblDCPayment where vChitName=@vChitName)
declare @fInstmount float
set @fInstmount=(select fInstAmount from tblChitInstalments where iChitId=@iChitId and iInstNumber=(select isnull(max(iInstNo),1) from tblDCPayment where vChitName=@vChitName))
print @fInstmount
declare @dInstDate datetime
set @dInstDate=(select dInstDate from tblChitInstalments where iChitId=@iChitId and iInstNumber=(select isnull(max(iInstNo),1) from tblDCPayment where vChitName=@vChitName))
print @dInstDate
declare @Balance float
set @Balance=(select isnull((@fInstmount-@fPaidAmount),0) from tblDCPayment where vChitName=@vChitName and iRegId=@iRegId)
INSERT INTO tblDCPayment(vChitName,iRegId,iInstNo,fInstAmount,dInstDate,fPaidAmount,fBalance,dPaidDate)
VALUES(@vChitName,@iRegId,@iInstNo,@fInstmount,@dInstDate,@fPaidAmount,@Balance,@dPaidate)
END