| Author |
Message |
kconnor@ncu.edu
Joined: 11 May 2012 Posts: 2
|
Posted: Fri May 11, 2012 10:36 pm Post subject: SQL Packager does not package dependencies in correct order? |
|
|
I'm trying to package a database with SQL Packager. This database contains objects with dependencies on other objects (i.e. a table created in a schema which must have the schema created prior to the table, or a table with FK constraints which obviously depends on the referenced table being created).
SQL Packager creates the SQL script to create the database, with the objects in absolutely horrid order.
For example... the create order for various objects in the script are as follows:
1. logins (even though I expressly unchecked the box to create these logins)
2. db users (I cleared the checkbox)
3. schemas
4. defaults
5. types
The very next object that gets created... is a Function.
And the function runs SELECT statements against tables in the database. But those tables aren't created yet.
So obviously the CREATE FUNCTION script errors out.
Why does this product not script object creation in the correct order of its dependencies? Looking through this DB creation script, it'll be an absolute nightmare to shuffle everything around in the correct order of dependency. I'll have to cut all the keys away from the tables and just create the tables as heaps, then go through and assign all the PK's, then assign all the FK's, and so on... all manually.
I bought your product so I wouldn't have to do that. I can do that on my own with SSMS. |
|
| Back to top |
|
 |
Chris Auckland
Joined: 24 Oct 2006 Posts: 710 Location: Red Gate Software Ltd.
|
Posted: Mon May 14, 2012 5:41 pm Post subject: |
|
|
Thanks for your post.
SQL Packager should script the objects in dependency order. If it's not doing that then it's either a bug, or you have a nasty circular dependency that we can't handle.
The logins and users have probably been re-added to your project because some other selected objects have a dependency to them. It's a default option to 'include dependencies'.
If you have SQL Compare, I would suggest setting up the same project and see if the script is correct using that. If you're creating an install package using SQL Packager, you can simulate this by using SQL Compare to a blank database. The reason I ask is because SQL Packager uses the SQL Compare engine; only a much older version. If the problem is still in the latest version of SQL Compare, then it's probably a new issue to us.
Let me know what you find. _________________ Chris |
|
| Back to top |
|
 |
kconnor@ncu.edu
Joined: 11 May 2012 Posts: 2
|
Posted: Thu May 17, 2012 5:52 pm Post subject: |
|
|
Chris, thank you for your response.
I did try SQL Compare against a blank database shortly after my original post, and got the same behavior.
Could this possibly be resolved in a 2-stage process by telling Packager to not include FK's in the 1st step, then telling Packager to only target FK's in a second stage (or using SQL Compare to grab the FK's)? Is this something these tools can do? |
|
| Back to top |
|
 |
Chris Auckland
Joined: 24 Oct 2006 Posts: 710 Location: Red Gate Software Ltd.
|
Posted: Fri May 18, 2012 10:03 am Post subject: |
|
|
Thanks for your reply.
You could try using the 'ignore foreign keys' option for the first pass.
I'm not exactly sure why you would need to do a 2 step sync', but I'm happy to look into it if you're able to send me a copy of your schema. _________________ Chris |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
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