Comments
5 comments
-
Hi,
Sorry, we don't have this feature in the GUI version yet. The command line version (available in the pro edition) lets you filter by object type and object name (see http://www.red-gate.com/MessageBoard/vi ... php?t=7845 for an example).
Can I ask why you don't want to compare the entire database?
Kind regards,
David Atkinson
Red Gate Software -
Sorry I was referring to the API. We need to move certain tables from one database to another and we already know which tables need to be moved.
-
Currently you can't register anything less than the whole database, and that's not likely to change in the future. The reason for this is dependencies - if we haven't registered the whole database we don't know what might depend on those tables you're trying to move, and so we can't be sure that it's safe to move them without also moving associated views, stored procedures etc etc that might rely on some element of the table that's changing.
-
Once you have compared the database schemata, you can then select which objects will appear in the script, if that helps. You can do this by looping through all of the DatabaseDifferences and and setting the "Selected" property to "true" or "false" depending on the conditions you set. So what you could do is loop through the database differences and set all of them to not be selected unless they meet the condition that the DatabaseObjectType is "table" and the name matches one in the list of names of tables that you want to migrate.
I hope this helps! -
To add to this, here is a small code sample to demonstrate Brian's post. (Based on our SQL Compare API sample project)
// Display the results on the console foreach (Difference difference in stagingVsProduction) { if (difference.Name == "<object name>") { Console.WriteLine("{0} {1} {2}", difference.Type, difference.DatabaseObjectType, difference.Name); difference.Selected = true; } }
Add comment
Please sign in to leave a comment.
Thanks