SQL Compare 13.7 Command Line - Exit Code 126 - SQL Error

howarthcdhowarthcd Posts: 70 Bronze 3
edited July 12, 2019 1:48PM in SQL Compare
Whenever exit code 126 is returned with an output log file configured, the output file does not appear to contain any details of the actual SQL error, making troubleshooting fiddly. The output file contains details up to the point that synchronisation is about to start, but nothing beyond that.

i.e.

...Checking for identical databases
Creating SQL
Saving SQL
Deploying changes (from DB1 to DB2)

<log end>

However when not logging to file the SQL error text is returned to the command window.

Is there a way to force writing the SQL error to the log file? Am I missing an option?

Using version 13.7.16.11325 with the following in a config file:

<?xml version="1.0"?>
<commandline>
  <server1>localhost</server1>
  <database1>MyDatabase</database1>
  <username1>admin</username1>
  <password1>p@ssw0rd</password1>
  <server2>localhost</server2>
  <database2>MyDatabase2</database2>
  <username2>admin</username2>
  <password2>p@ssw0rd</password2>
  <ignoreparsererrors />
  <out>C:\Temp\output.txt</out>
  <options>IgnoreUsersPermissionsAndRoleMemberships,IncludeDependencies,IgnoreKeys,DisableAndReenableDdlTriggers,NoTransactions,NoDeploymentLogging,IgnoreIndexes,AddDatabaseUseStatement</options>
  <loglevel>Verbose</loglevel>
  <report>C:\Temp\report.xml</report>
  <reporttype>XML</reporttype>
  <scriptfile>C:\Temp\scriptfile.sql</scriptfile>
  <synchronise />
  <verbose />
  <force />
</commandline>


Thanks
Chris
Tagged:

Answers

  • howarthcdhowarthcd Posts: 70 Bronze 3
    I've come up with a workaround which is to append the contents of the StandardError property (which contains the SQL error message) of the SQL Compare process to the output text file.

    Not ideal but it does the job in my particular situation.
  • Eddie DEddie D Posts: 1,780 Rose Gold 5
    Hi, Thank you for your forum post.

    There are no other options other than the   <loglevel>Verbose</loglevel> (/LogLevel:Verbose).  In my experience if the logging process is able to capture the SQL Error details it will include this in the log file.

    As you are using the XML argument file to specify the command line arguments, do you experience the same problem using the command line switches? For example:

    sqlcompare   /server1:localhost /database1:MyDatabase /username1:MyUserName /password1:p@ssw0rd /server2:localhost /database2:MyDatabase2 /username2:MyUserName /password2:p@ssw0rd /ignoreparsererrors /out:"C:\Temp\output.txt" /options:IgnoreUsersPermissionsAndRoleMemberships,IncludeDependencies,IgnoreKeys,DisableAndReenableDdlTriggers,NoTransactions,NoDeploymentLogging,IgnoreIndexes,AddDatabaseUseStatement /loglevel:Verbose /report:"C:\Temp\report.xml" /reporttype:XML /scriptfile:"C:\Temp\scriptfile.sql" /synchronise /verbose /force

    Or using the GUI?

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