How the SQL compare include/exclude object types works
ToddY
Posts: 4 New member
in SQL Compare
Hi,
I am trying to call SQL Compare to sync 2 databases with command line, such as "/include:table /include:schema /include:view /include:Identical"
However, it only synced tables and schema, but the views are not synced. I inherited the code and I guess somewhere there is a definition of exclusion and that exclusion overrides the "/include:view". but I cannot find where the exclusion is defined.
Any suggestions of how to include the sync of view?
I am trying to call SQL Compare to sync 2 databases with command line, such as "/include:table /include:schema /include:view /include:Identical"
However, it only synced tables and schema, but the views are not synced. I inherited the code and I guess somewhere there is a definition of exclusion and that exclusion overrides the "/include:view". but I cannot find where the exclusion is defined.
Any suggestions of how to include the sync of view?
Tagged:
Answers
Thanks.
Tianjiao Li | Redgate Software
Have you visited our Help Center?
Thanks for looking at my question.
The full command line script was dynamically generated from SSIS's C# code, and it will look like this:
/server1: S1 /username1: u1 /password1: p1 /database1: D1 /server2: S2 /username2: u2 /password2: p2 /database2: D2 /force /synchronize /options: DecrypPost2KEncrypted,IgnoreFillfactor,IgnoreWhleSpace,Ignfore fileGroup,IgnoreUserProperties,IgnoreWithElementOrders,IgnoreDatabaseAndServerName /include:userdefinedType /include:table /include:schema /include:view /include:identical /loglevel:Verbose /Out:C:\Temp\serverDB_output.txt
It works on syncing table and schema, but not view. Really strange. Please help.
Thanks again.
Todd Yu
Thanks for sharing the command script, however, I wasn't able to reproduce it with my database.
If you use the UI, with the same options, do you see the views?
Tianjiao Li | Redgate Software
Have you visited our Help Center?
I am new to SQL Compare. From the UI, I am seeing many options under the "Behavior" and "Ignore" when I open a SCP file. but where I can see the "include" and "exclude" options?
Thanks,
Here is the SSIS code that got called:
As you can see, after passing the arguments with " startInfo.Arguments = sb.ToString();", the process.Start() will start to compare and sync. It does sync table and synonym very well, but it excludes "view", even if I explicitly includes view. I guess somewhere in the UI has an exclude settings? But I don't know where the include/exclude setting are from the UI.
Thanks
It's worth verifying if SQL Compare behaves as expected out of the SSIS code. Please open a command prompt and try:
C:\Program Files (x86)\Red Gate\SQL Compare 13>sqlcompare /s1:SERVER1 /db1:DATABASE1 /s2:SERVER2 db2:DATABASE2 /options:DecryptPost2KEncryptedObjects,IgnoreFillfactor,IgnoreWhiteSpace,IgnoreFileGroups,IgnoreUserProperties,IgnoreWithElementOrder,IgnoreDatabaseAndServerName /include:userdefinedType /include:table /include:schema /include:view /include:identical
Do you see views in the comparison result?
More about the switches and options:
https://documentation.red-gate.com/sc13/using-the-command-line/command-line-basics#Commandlinebasics-The/Optionsswitch
Tianjiao Li | Redgate Software
Have you visited our Help Center?