Script to Insert AR_Customer Records From Backup Table (Internal)

Issue:

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

INSERT INTO dbo.AR_Customer

           (Customer_Id,Customer_Number,Customer_Status_Id,Customer_Type_Id,Collection_Status_Id

,Dealer_Id,Owned_By_Dealer_Id,Salesperson_Id,Term_Id,Tax_Exempt_Num,Blanket_PO,Blanket_PO_Expire,Old_Customer_Number,Total_RMR,OK_To_Incr_Date,No_Late_Fees,No_Statements,Last_Statement_Date,StatementBalance,Print_Sites_On_Bills,Print_Statements,Print_Cycle_Invoices,RollUp_Recurring,Customer_Since,Customer_Group_Id,Customer_Relation_Id,Master_Account_Id,Branch_Id,Customer_Name,No_Collections,Salesperson_Commission_Pctg,Customer_Group2_Id,Customer_Name_2,Part_Pricing_Level,Master_Account_Billing,Business_Number,Invoice_Group_Number,Registration_Code)

      

Select Customer_Id,Customer_Number,Customer_Status_Id,Customer_Type_Id,Collection_Status_Id

,Dealer_Id,Owned_By_Dealer_Id,Salesperson_Id,Term_Id,Tax_Exempt_Num,Blanket_PO,Blanket_PO_Expire,Old_Customer_Number,Total_RMR,OK_To_Incr_Date,No_Late_Fees,No_Statements,Last_Statement_Date,StatementBalance,Print_Sites_On_Bills,Print_Statements,Print_Cycle_Invoices,RollUp_Recurring,Customer_Since,Customer_Group_Id,Customer_Relation_Id,Master_Account_Id,Branch_Id,Customer_Name,No_Collections,Salesperson_Commission_Pctg,Customer_Group2_Id,Customer_Name_2,Part_Pricing_Level,Master_Account_Billing,Business_Number,Invoice_Group_Number,Registration_Code

From ar_customer_BackUpTable

Where Customer_id in(1234)

        

SET IDENTITY_INSERT AR_Customer OFF

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

Thank you! Your comment has been submitted for approval.