Script to Insert SV_Inspection Records from Backup Table

Issue:

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

GO

 INSERT INTO SV_Inspection

           (Inspection_Id,Customer_System_Id,Inspection_Cycle_Id,Problem_Id,Description,Next_Inspection_Date,Last_Inspection_Date,Notes,Last_Service_Ticket_Id,Service_Level_id,Job_Id,Route_Id,Service_Company_Id,Inspection_Item_Id,Inspection_Charge_Amount,Group_Number,Estimated_Hours,Service_Tech_Id,High_Frequency_Omit,Customer_Recurring_Id,Cycle_Amount,Recurring_Item_Id,Terminated,Terminated_Date,Terminated_By,Exclude_In_Frequency_Omit,Increment_Code_Id)

Select Inspection_Id,Customer_System_Id,Inspection_Cycle_Id

,Problem_Id,Description,Next_Inspection_Date,Last_Inspection_Date,Notes,Last_Service_Ticket_Id,Service_Level_id,Job_Id,Route_Id,Service_Company_Id,Inspection_Item_Id,Inspection_Charge_Amount,Group_Number,Estimated_Hours,Service_Tech_Id,High_Frequency_Omit,Customer_Recurring_Id,Cycle_Amount,Recurring_Item_Id,Terminated,Terminated_Date,Terminated_By,Exclude_In_Frequency_Omit,Increment_Code_Id

From sv_inspection_115775 

GO

SET IDENTITY_INSERT SV_Inspection off

GO