0

We have a SQL Server database deployed out into multiple environments. Usually when we export the data out using Tasks --> Generate Scripts the dependency order is maintained and the resulting script can be run into a fresh database with the same schema.

On one particular database this is not happening. The dependency order is wrong and the resulting scripts fails.

The databases were all created the same way and in all instances we are following the same process to export the data:

  • Right-click database and go to Tasks --> Generate Scripts
  • Select specific database objects -> Select tables (always the same set)
  • Select Advanced --> Type of data to export = Data Only

Have checked the options in SSMS --> Tools --> Options --> SQL Server Object Explorer --> Scripting and they match between environments.

Is there anything else that could cause the order to be wrong? We have this running fine on multiple versions. The one that fails is 2014 SP3.

Neil
  • 159
  • 10
  • The dependency order is fine if we select 'Script entire database and all database objects'. This is workable in this instance but would still be good to know why it doesn't work for a subset of tables. (The other tables we usually ignore are code generated and have no dependencies to the ones we are exporting). – Neil Mar 15 '19 at 15:10
  • I used Red Gate SQL Compare, They maintain dependency. [Red Gate SQL Compare](https://www.red-gate.com/products/sql-development/sql-compare/?gclid=CjwKCAjwmq3kBRB_EiwAJkNDp2dws6epJbAls4BXOc69_1nwBXn7ovETOi8Pok2SS3eVV7sIFbU9EBoCCVwQAvD_BwE&gclsrc=aw.ds) – Hasan Mahmood Mar 15 '19 at 15:29

0 Answers0