Script to Insert OE_Job_Parts Records from Backup Table

Issue:

There may be a need to restore records from a backup of the OE_Job_Parts when working on a data issue.

Resolution:

The records can be copied into the original table from the backup if needed. The script below can be used to restore the data to its original state using the script below.

Using the backup table name from your original select statement, change the table name in the From clause to the correct one.

You can use the Where clause to copy over one or more records or to restore all the records it can be removed.

--select * into oe_job_parts_12345 from OE_Job_Parts

SET IDENTITY_INSERT OE_Job_Parts on

GO


INSERT INTO [dbo].[OE_Job_Parts]

([Job_Part_Id], [Customer_Id],[Customer_Site_Id]

,[Job_Id],[Job_System_Id],[Part_Id],[Quantity],[Rate],[Amount],[Location]

,[Invoice_Item],[Master_Item_Id],[Labor_Units],[Master_Job_Part_Id],[Issued_Qty],[Purchase_Cost]

,[Purchase_Description],[Vendor_Id],[Part_Description],[Phase_Id],[Issue_From_Stock]

,[Max_Invoice_Rate],[Invoiced_Qty],[Invoice_Amount],[Credit_Amount],[Local_Zone],[Tax_Exempt])

 

Select 

Job_Part_Id, Customer_Id,Customer_Site_Id,Job_Id, 

Job_System_Id,Part_Id, Quantity,Rate,Amount,Location,Invoice_Item,

Master_Item_Id, Labor_Units,Master_Job_Part_Id,Issued_Qty,Purchase_Cost,

Purchase_Description, Vendor_Id,Part_Description,Phase_Id,Issue_From_Stock, 

Max_Invoice_Rate, Invoiced_Qty, Invoice_Amount, Credit_Amount, Local_Zone, Tax_Exempt

From oe_job_parts_12345

where job_part_id = 12345

 

GO

SET IDENTITY_INSERT OE_Job_Parts off

GO

Was this article helpful?
Thank you for your feedback!
User Icon

Thank you! Your comment has been submitted for approval.