Options

Can't /exclude:table

jhoganjhogan Posts: 9
edited April 1, 2010 12:31PM in SQL Compare Previous Versions
I'm having a pretty straightforward problem. I can't exclude tables using the command line tool. I can exclude stored procedures though. Here is my command:
SQLCompare.exe  /database1:mydb1 /database2:mydb2/scriptfile:"C:\out.sql" /exclude:table:mytbl
Buried in c:\out.sql is DDL I would expect if the table were not excluded:
PRINT N'Altering [dbo].[mytbl]'
GO                 
ALTER TABLE [dbo].[mytbl] ADD
[mycol] [int] NULL
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
ALTER TABLE [dbo].[mytbl] DROP
COLUMN [mycol2]
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO


I'm using 8.1.0.360
I'm I misunderstanding something?
I've tried with several other tables too.
Thanks in advance for your help.

Comments

  • Options
    Eddie DEddie D Posts: 1,781 Rose Gold 5
    Thank you for your post into the forum.

    From the example code, you have not specified any options therefore by default, the default options are set which includes the 'Include Dependencies' option. The list of default options are as follows:
      DecryptPost2KEncryptedObjects IgnoreFillFactor IgnoreWhiteSpace IncludeDependencies IgnoreFileGroups IgnoreUserProperties IgnoreWithElementOrder

    I suspect that the table you wish to exclude has dependencies to other objects in the database hence why the table has not been excluded from the synchronization script.

    If you not wish to use the default options you must select at least one option, using the /options switch. For example:
    SQLCompare.exe  /database1:mydb1 /database2:mydb2/scriptfile:"C:\out.sql" /exclude:table:mytbl  /options:IgnoreWhiteSpace, IgnoreTriggers
    

    In my example the options will ignore any white space and ignore triggers. The default options will not used.

    The SQL Compare Help file contains the full list of available options that can be specified using the command line.

    Hope the above helps.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Options
    Thanks for your elucidations. I was able to confirm that that was the problem. I explicitly added all the default options save "IncludeDependencies" and confirmed that this eliminated the unwanted DDL. Thanks a lot.

    If I could make a recommendations I would suggest adding this caveat to the /exclude section of the help file because I spent quite a while playing with this trying to get it to work.

    Anyway, thanks.
  • Options
    Eddie DEddie D Posts: 1,781 Rose Gold 5
    Thank you for your reply and excellent news that the problem is now resolved.

    I submitted a feature request for the SQL Compare Development Team to consider, making the information regarding the default options for the comand line Interface more prominent.

    The reference number for this request is SC-4642.

    I cannot guarantee the success of the request submitted, however if approval is given you will hopefully see it in a future version of the documentation.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
Sign In or Register to comment.