Script to Insert OE_Job Records from Backup Table

Issue:

There may be a need to restore records from a backup of the OE_Job table 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.

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.

SET IDENTITY_INSERT OE_Job on

GO

INSERT INTO dbo.OE_Job

(Job_id,Job_Code,Customer_Id,Customer_Site_Id,Job_Status_Id

,Job_Type_Id,Description,Salesperson_Id,Department_Id,Amount,Billed_Amount,RMR_Amount,Billed_RMR_Amount,Sold_Date,Start_Date

,Projected_End_Date,End_Date,PO_Number,Installer_Id,Memo,Est_Material,Est_Labor,Est_Other,Change_Order,Master_Job_Id,Bill_On_Day

,Bill_Thru_Day,Hold_Back_Pctg,Taxing_Group_Id,Job_Locked,EstOverhead,EstCommission,Reversal,Install_Company_Id,TotalLaborUnits,PartLaborUnits

,InstallLaborUnits,Labor_Units,Total_RMR_Amount,Total_Billed_RMR_Amount,Install_Amount,Part_Amount,Proj_Mgr_Id,Prevailing_Wage,Permit_Required

,Permit_1,Permit_2,Permit_3,Quote_Id,Branch_Id,Commission_Multiplier,Commission_Approval_Date,Commission_Approved_By,Salesperson2_Id

,Salesperson1_Commission_Pctg,Salesperson2_Commission_Pctg,Creation_Date,Entered_By,Override_Task_List,Sales_Split,Units_Used

,Outside_Invoicing_Done,Est_Custom_JC1_Total,Est_Custom_JC2_Total,Est_Custom_JC3_Total,Contact,Customer_Bill_Id,OPT_rowguid,Invoice_Site_Id)

     

Select Job_Id,Job_Code,Customer_Id,Customer_Site_Id,Job_Status_Id

,Job_Type_Id,Description,Salesperson_Id,Department_Id,Amount,Billed_Amount,RMR_Amount,Billed_RMR_Amount,Sold_Date,Start_Date

,Projected_End_Date,End_Date,PO_Number,Installer_Id,Memo,Est_Material,Est_Labor,Est_Other,Change_Order,Master_Job_Id,Bill_On_Day

,Bill_Thru_Day,Hold_Back_Pctg,Taxing_Group_Id,Job_Locked,EstOverhead,EstCommission,Reversal,Install_Company_Id,TotalLaborUnits,PartLaborUnits

,InstallLaborUnits,Labor_Units,Total_RMR_Amount,Total_Billed_RMR_Amount,Install_Amount,Part_Amount,Proj_Mgr_Id,Prevailing_Wage,Permit_Required

,Permit_1,Permit_2,Permit_3,Quote_Id,Branch_Id,Commission_Multiplier,Commission_Approval_Date,Commission_Approved_By,Salesperson2_Id

,Salesperson1_Commission_Pctg,Salesperson2_Commission_Pctg,Creation_Date,Entered_By,Override_Task_List,Sales_Split,Units_Used

,Outside_Invoicing_Done,Est_Custom_JC1_Total,Est_Custom_JC2_Total,Est_Custom_JC3_Total,Contact,Customer_Bill_Id,OPT_rowguid,Invoice_Site_Id

From oe_job_121137

Where job_id in (6649,6651)

GO

SET IDENTITY_INSERT OE_Job off

GO

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

Thank you! Your comment has been submitted for approval.