0
hi
u need to give brakets
example :
declare @qty int
set @qty=(select qty from tablename)
u can execute the fallowing procedure.
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
0
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)