I am using the Export Data functionality in Studio to export my entire database data via a single SQL Script.
The challenge I'm finding is that some of my tables have foreign key relationships to other tables, but the script created isn't taking that into account - So, for example, I have Table B that has a foreign key to a column in Table A (which would mean Table A needs to be populated first), but the script has Table B being populated before Table A and, therefore, it is causing a SQL error due to the data not being present in Table A yet.
Any thoughts about how to ensure the "parent" tables are populated before the tables that rely on their data?
Export data not taking foreign key relationships into account
Re: Export data not taking foreign key relationships into account
You can use the 'Generate Scripts' feature (select 'Database -> Tasks -> Generate Scripts...' from the main menu) where you can select the 'Data' option only on the 'Script content' page of the generate scripts wizard. This way, dependencies will be taken into account.
Re: Export data not taking foreign key relationships into account
That gives me the same functionality as SSMS, but I lose the ability to create Merge statements.
Is there a way to have this functionality of knowing dependants AND be able to get the scripts written as Merge?
Is there a way to have this functionality of knowing dependants AND be able to get the scripts written as Merge?
Re: Export data not taking foreign key relationships into account
We will support this functionality in one of the next product versions.