I have a trigger which was working earlier perfectly. But later on, as required I added some more lines into that which is below
declare @imkey numeric(10,0);declare @xmkey numeric(10,0); declare @xsrno numeric(10,0)
select @xmkey=max([Mkey])+1, @xsrno=max([Entry_Sr_No])+1
from erp190516.[dbo].[Inward_Doc_Tracking_Trl] where Ref_Mkey=@imkey;
select @imkey=i.Inward_ref_key from inserted i
insert into erp190516.[dbo].[Inward_Doc_Tracking_Trl]
SELECT @xmkey,@xsrno,[N_UserMkey],'1' [N_Department], 'F' [CStatus_Flag]
,'Requester' [Remarks],'1' [CUser_ID],getdate() [U_Datetime],
,'N' [NStatus_Flag], 'N' [Delete_Flag]
,'1'[CDept_Id],[Ref_Mkey],[No_Of_Days],[Approved_Amount],[Chq_No],[Chq_dated]
,[Chq_Bank],[Chq_Amount],[Vendor_MKey],[Vendor_Comp_Mkey]
,[Project_Mkey],[Program_mkey],[Payment_MKey],[Due_Date],[Updated_Remarks]
,[Updated_Bill_no],[Updated_Bill_Date],[Updated_Bill_Amt]
,[Party_Name],[Acc_mkey],[TotalDeductions],[Broker_Mkey],[Customer_Mkey]
,[Payable_Amt],[Balance_Amt],[Receipt_No],[Po_No],[Bill_No]
,[Disp_through],[Disp_Through_Name],[Site_Id]
FROM erp190516.[dbo].[Inward_Doc_Tracking_Trl] where Ref_Mkey=@imkey
It eexcuted perfectly, but while inserting the data into the table I got error as
Error converting data type varchar to numeric
Aucun commentaire:
Enregistrer un commentaire