RKh
RKh

Reputation: 14159

How to generate scripts for production database?

I have a development database where I have added new records to a number of tables.

I want to move these changes to production database. The problem is that the ID columns in both have different values.

For ex. Last StudentId in dev is 10 and in production it is 25. Therefore the corresponding FK IDs also different.

I have generated scripts but I am bit puzzled on how to execute on production because of this issue.

One other approach is that I have even exported data from tables and pasted to Excel. In Excel I will update the IDs and paste this to production table.

What is the best practice to do this safely?

Upvotes: 0

Views: 870

Answers (1)

Tab Alleman
Tab Alleman

Reputation: 31775

The best practice is to write scripts that will not depend on hard-coded ID values, so that you can run the script in Dev, and it will generate some values based on the data there, and then you can run the exact same script in Production, and it will also work based on the existing data there.

Upvotes: 1

Related Questions