i have a stored procedure .....
which executed successfully .
in this i use the concept of temrary table ....
but it don't working when i work through web page ..it gives error ...
pls tell whats the problem in it ...any help pls ...
alter PROCEDURE [dbo].[sp_InsertIntoTempPaymentnew]
(
@Center_Id int,
@Data_Inserted_By int,
@Company_U_Id int
)
AS
BEGIN
SELECT ClientLoanSubscriptionInfo.Center_Id,ClientLoanSubscriptionInfo.Proposal_ID, ClientLoanSubscriptionInfo.SubGroup_Id, CenterInfo.AssignedStaff, ClientLoanSubscriptionInfo.Client_Id,
subloan_product.installment_amount,
SUM(subloan_product.installment_amount + ClientLoanSubscriptionInfo.Principle_Arrear + ClientLoanSubscriptionInfo.Interest_Arrear - ClientLoanSubscriptionInfo.Advance) as TodaysDueAmt
, DayOpenDayCloseInfo.CenterCollectionDate,ClientLoanSubscriptionInfo.Company_U_Id,ClientLoanSubscriptionInfo.AdvancePeriod
into #MYTEMPTABLE
FROM ClientLoanSubscriptionInfo INNER JOIN
subloan_product ON ClientLoanSubscriptionInfo.SubProduct_id = subloan_product.Subloan_Product_Id INNER JOIN
CenterInfo ON ClientLoanSubscriptionInfo.Center_Id = CenterInfo.Center_Id INNER JOIN
DayOpenDayCloseInfo ON CenterInfo.Center_Id = DayOpenDayCloseInfo.Center_Id
WHERE (ClientLoanSubscriptionInfo.Center_Id = @Center_Id) AND (ClientLoanSubscriptionInfo.Loan_Status = 1) AND (DayOpenDayCloseInfo.CollectionByLoanOfficerStatus = 0) AND
(DayOpenDayCloseInfo.DayCloseByAdminStatus = 0)
GROUP BY ClientLoanSubscriptionInfo.Center_Id, ClientLoanSubscriptionInfo.SubGroup_Id, ClientLoanSubscriptionInfo.Client_Id, subloan_product.installment_amount,
CenterInfo.AssignedStaff, DayOpenDayCloseInfo.CenterCollectionDate,ClientLoanSubscriptionInfo.Company_U_Id ,ClientLoanSubscriptionInfo.Proposal_ID ,ClientLoanSubscriptionInfo.AdvancePeriod
update #MYTEMPTABLE set TodaysDueAmt=0 where AdvancePeriod>0
INSERT INTO [dbo].[TempPaymentShceduleInfo]
([Center_Id]
,[Proposal_ID]
,[SubgroupId]
,[Staff_Id]
,[Client_Id]
,[DefaultInstallmentAmt]
,[TodaysDueAmt],[DayOpen],[Company_U_Id]
)
select [Center_Id],[Proposal_ID],[SubgroupId] , [Staff_Id],[Client_Id],[DefaultInstallmentAmt],
[TodaysDueAmt],[DayOpen],[Company_U_Id] from #MYTEMPTABLE
UPDATE [dbo].[TempPaymentShceduleInfo]
SET
[PaymentAmtCollected] = 0
,[LoanOfficerPaymentStatus] =0
,[DayCloseByAdminStatus] = 0
,[IsMobileData] =0
,[Data_Inserted_By] = 1
,[Date_Of_Insertion] = getdate()
,[IsActive] = 1,CountUpdate=0
WHERE IsActive is Null and Center_Id=@Center_Id and Company_U_Id=@Company_U_Id
END