Red Gate forums :: View topic - Command line and /Include:Identical and /Filter
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

Command line and /Include:Identical and /Filter

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
robermar2



Joined: 21 Mar 2012
Posts: 5

PostPosted: Tue Mar 27, 2012 9:29 pm    Post subject: Command line and /Include:Identical and /Filter Reply with quote

We are using the sql command line to help automate our database deployments.

In order to not get build failures when the schemas happen to be exact, we have to use the /Include:Idential switch for the command line.

However we also need to use a filter so the compare also only includes certain schemas and we also don't want to inlude users and roles in the compare.

We have a filter file saved from the sql compare user interface.

However, according to the error reported by sql compare command line and your documentation, you can't use /Identical and /Filter at the same time.

How else can we use a filter but also not have the command line report a failure when the databases happen to be exact at the time it is run?

I can't imagine that we are the only ones who have run into this.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6644

PostPosted: Wed Mar 28, 2012 9:13 am    Post subject: Reply with quote

Hello,

Actually, no there has been a lot of complaints about include:identical so in 10.1 there is an /assertidentical switch you can use. This will replace error code 63 with error code 0 so your EXEC tasks don't fail and you don't have identical items in the results.
Back to top
View user's profile Send private message
robermar2



Joined: 21 Mar 2012
Posts: 5

PostPosted: Wed Mar 28, 2012 2:22 pm    Post subject: Thanks Reply with quote

Great, I will give that a try.

Thanks for the quick response.
Back to top
View user's profile Send private message
robermar2



Joined: 21 Mar 2012
Posts: 5

PostPosted: Wed Mar 28, 2012 3:23 pm    Post subject: Another error Reply with quote

I tried using the /assertidentical switch so that the command line does not fail when the schemas are identical.

However, now I receive this error:

Error: The /assertidentical switch cannot be used in conjunction with the
/synchronize switch. Please use SQLCompare.exe /? or SQLCompare.exe for more information.

I am actually trying to deploy changes, if there are any, so I have to use /synchronize. I also save the delta script to a file using /sf.

I don't understand why I can't use the switches at the same time.

I want to use a filter. I want to actually have the changes committed to the database being compared. I don't want it to fail if the schemas happen to be identical.

Any help would be greatly appreciated.
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1144
Location: My desk.

PostPosted: Mon Apr 02, 2012 8:38 pm    Post subject: Reply with quote

Thanks for your further post. It appears you're correct- we've got an existing internal bug that the assertidentical also can't be used with the report option.

From what I can tell, the assertidentical switch is intended to do just that- test if the databases are identical. So the workaround right now would seem to be to perform the compare with just that switch, grab the error code, and if the two databases are identical (error code 0), exit the script. If they differ (exit code 79) then proceed to the filtered sync.

I'll add a link to this thread as it does seem a bit pointless comparing once just to establish whether it should then "really" compare and sync.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6644

PostPosted: Tue Apr 03, 2012 9:15 am    Post subject: Reply with quote

I guess the best thing for now would be to go back to the old batch job workaround...
Code:
SQLCompare.exe /db1:...
IF %ERRORLEVEL% EQU 63 GOTO EQUAL
EXIT /B %ERRORLEVEL%
EQUAL:
EXIT /B 0
Back to top
View user's profile Send private message
robermar2



Joined: 21 Mar 2012
Posts: 5

PostPosted: Tue Apr 03, 2012 8:05 pm    Post subject: with powershell Reply with quote

Have you guys tried executing the same kind of thing in a power shell script instead of a batch file in an attempt to "eat" error code 63?

I would think this would work fine, but I am running into some issues where the compare works, but any output I request does not.

I am passing parameters for the script file output, html report as well as trying to limit the scope of the compare using a filter file. When passing this directly to the command line, it works fine.

However, when trying to pass all of this through a power shell script, I receive no errors, the compare works, but it ignores my filter file, does not output the script file and it does not save the html report.

I am going to submit a support ticket and provide you the power shell script I am trying to run.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic 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