SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Logical Ordering of Table data script

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Logical Ordering of Table data script
Author Message
hitesh



Joined: 15 Oct 2007
Posts: 104

Post Logical Ordering of Table data script Reply with quote
There is logical ordering issue when table data sql script is generated and same is run later on. By default table data script is generated in ascending order of table name, so in my cases child table data script is generated 1st and then parent table data and when i run the sql script it tries to insert records in child table and fails becoz parent table data not yet inserted. So to avoid this issue I would like to suggest to make table order bit intelligent so that this situation can be avoided.

I suggest the order of table data should be bit logical...

1. Script table data do NOT have PKs defined
2. Script table data with only UNIQUE constraint defined
3. Script table data which has only PKs defined but has no FK relationship with any table
4. Script all other tables with PK/FK relationship.

I hope my point of suggestion is clear.
Wed Feb 05, 2014 8:41 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7857

Post Reply with quote
Hello, I understand your point. The Script Table Data tool is not designed to follow any sort of table dependencies. This tool is designed for generating SQL scripts for cross-platform data loading, basically for dumping data as SQL scripts. If you want to use it for reloading the data, you can use the following method, disable all referential constraints, execute the generated INSERT scripts, then re-enable constraints. See an example here http://stackoverflow.com/questions/14972816/how-to-disable-constraints-for-all-the-tables-and-enable-it.

In comparison, the XML Data Schema Export/Import tool is smarter. It is designed to analyze table referential integrity constraints and to dump the data into XML files so that they can be loaded back in a proper order. It also supports additional options for appending, replacing, truncating target tables during loading dynamically checking their content. It can also map individual columns, ignore auto-generated values such as computed columns and identity columns, and so on. This tool is much more sophisticated. I suggest to try this tool instead of the data scripting.
Wed Feb 05, 2014 10:50 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.