sql compare command line exit code 0, missing tables

tryggviFMEtryggviFME Posts: 3 New member
edited June 19, 2019 11:10AM in SQL Compare
I'm running the following command : sqlcompare.exe /project:[Project name] /filter:testfilter.scpf /AssertIdentical  and I'm trying to to get an non zero exit code.  i.e. 79.

The filter does include a table comparison while omitting users and roles. 
If I run the scpf file in sql compare I can clearly see that I'm missing a few tables, but otherwise the DB is identical to my source folder. 

Am I doing something wrong?  Some switch missing?

Best Answer

  • tryggviFMEtryggviFME Posts: 3 New member
    edited June 21, 2019 10:10AM Accepted Answer
    I just figured this out. My fault. I had unchecked the missing tables from the table list in the project file, so the program was working as expected. 

Answers

  • Sergio RSergio R Posts: 415 Rose Gold 1
    edited June 20, 2019 12:45PM
    I have just tested this and it seems to be working correctly in my case, if you are missing a few tables then you should be getting error level 79

    (in the example below the source has an additional table)

    C:\Program Files (x86)\Red Gate\SQL Compare 13>sqlcompare.exe /s1:W2K16-1 /db1:140617_source /s2:W2K16-1 /db2:140617_target /assertidentical /v
    SQL Compare Command Line V13.7.13.10771
    ======================================================================================================================
    Copyright Copyright c Red Gate Software Ltd 2019

    Argument /server1 has value 'W2K16-1'
    Argument /database1 has value '140617_source'
    Argument /server2 has value 'W2K16-1'
    Argument /database2 has value '140617_target'
    Argument /assertidentical has value 'True'
    Argument /verbose has value 'True'

    Redgate Client capability version: 2
    SQL Compare: activated, edition professional, serial number:
    Comparing database W2K16-1.140617_source with database W2K16-1.140617_target...
    Registering data sources
    Creating mappings
    Comparing
    Applying Command Line Items
    Retrieving migration scripts
    Checking for identical databases

    Summary Information
    =======================================================================================================================
    DB1 = W2K16-1.140617_source
    DB2 = W2K16-1.140617_target

    Object type             Name                                                                                   DB1 DB2
    -----------------------------------------------------------------------------------------------------------------------
    Table                   [dbo].[T2]                                                                             >>
    -----------------------------------------------------------------------------------------------------------------------

    Details - comparing W2K16-1.140617_source with W2K16-1.140617_target
    =======================================================================================================================
    Table [dbo].[T2]
    >> CREATE TABLE [dbo].[T2]
    >> (
    >> [C1] [nchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    >> )
    >> GO
    -----------------------------------------------------------------------------------------------------------------------


    C:\Program Files (x86)\Red Gate\SQL Compare 13>echo %errorlevel%
    79

    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • tryggviFMEtryggviFME Posts: 3 New member
    I'm using the switch /project and I'm getting exit code 0.

    Here is the output.
    C:\RedGateSQLCompareProjects\Dev>sqlcompare /project:XXXXX.scp /filter:testfilter.scpf /assertidentical /v
    SQL Compare Command Line V13.7.13.10771
    ==============================================================================================================================================================
    Copyright Copyright © Red Gate Software Ltd 2019

    Argument /project has value 'XXXXX.scp'
    Argument /filter has value 'testfilter.scpf'
    Argument /assertidentical has value 'True'
    Argument /verbose has value 'True'

    Redgate Client capability version: 2
    SQL Compare: activated, edition professional, serial number: 512-001-140195-498A
    Loading synchronization parameters from project file: XXXXX.scp
    OK
    Comparing database Scripts.XXXXX with database DEV-SQL2016.S_XXXXX...
    Registering data sources
    Creating mappings
    Comparing
    Summarizing Project Selections
    Retrieving migration scripts
    Checking for identical databases

    Summary Information
    ==============================================================================================================================================================
    DB1 = XXXXX
    DB2 = DEV-SQL2016.S_XXXXX

    Object type             Name                                                                                                                           DB1 DB2
    --------------------------------------------------------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    Details - comparing XXXXX with DEV-SQL2016.S_XXXXX
    ==============================================================================================================================================================
    C:\RedGateSQLCompareProjects\Dev>echo %errorlevel%
    0


    If I use /scripts1 with /s2 and db2 I get an error code 79 with a list of tables that need syncing or are missing.
    That works fine.
    The project switch is not returning the exit code I would have expected.

  • Sergio RSergio R Posts: 415 Rose Gold 1
    If you look at the output, in your case, SQL Compare is not detecting any differences (in my case there's an additional table in the source) so an exit code of 0 is correct.

    I have tested now with a scripts folder as the source, a project file and a filter file to replicate your scenario as closely as possible and in my case I still can't find any issues.

    I will contact you directly through our support system
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
Sign In or Register to comment.