0 byte output on equal compare result
jeljeljel2
Posts: 4 Bronze 1
in SQL Compare
Hi, when using sqlcompare.exe from the command line, in the past if there were no changes, the output would be a 0 byte file. Using this as a marker, it was easy to tell if there was a script needed to be run or not.
It seems this has changed. If the result of a compare is 'no changes', it now writes a 2Kb file that does nothing. I have attached a sample of what this looks like below.
Is there a way to prevent this from happening and go back to the 0 byte file when there are no changes? What is the reasoning for writing a change file that does nothing?
Here are the file contents I am referring to...
It seems this has changed. If the result of a compare is 'no changes', it now writes a 2Kb file that does nothing. I have attached a sample of what this looks like below.
Is there a way to prevent this from happening and go back to the 0 byte file when there are no changes? What is the reasoning for writing a change file that does nothing?
Here are the file contents I am referring to...
/*
Run this script on:
..BigWave.Master - This database will be modified
to synchronize it with:
..BigWave.Master
You are recommended to back up your database before running this script
Script created by SQL Compare version 14.4.4.16824 from Red Gate Software Ltd at 1/6/2021 6:21:44 PM
*/
SET NUMERIC_ROUNDABORT OFF
GO
SET ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT ON
GO
SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
BEGIN TRANSACTION
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@ERROR <> 0 SET NOEXEC ON
GO
COMMIT TRANSACTION
GO
@ERROR <> 0 SET NOEXEC ON
GO
-- This statement writes to the SQL Server Log so SQL Monitor can show this deployment.
IF HAS_PERMS_BY_NAME(N'sys.xp_logevent', N'OBJECT', N'EXECUTE') = 1
BEGIN
DECLARE @databaseName AS nvarchar(2048), @eventMessage AS nvarchar(2048)
SET @databaseName = REPLACE(REPLACE(DB_NAME(), N'\', N'\\'), N'"', N'\"')
SET @eventMessage = N'Redgate SQL Compare: { "deployment": { "description": "Redgate SQL Compare deployed to ' + @databaseName + N'", "database": "' + @databaseName + N'" }}'
EXECUTE sys.xp_logevent 55000, @eventMessage
END
GO
DECLARE @Success AS BIT
SET @Success = 1
SET NOEXEC OFF
IF (@Success = 1) PRINT 'The database update succeeded'
ELSE BEGIN
@TRANCOUNT > 0 ROLLBACK TRANSACTION
PRINT 'The database update failed'
END
GO
Tagged:
Best Answer
-
David Atkinson Posts: 1,462 Rose Gold 2It might be more reliable to use exit codes as the indicator. If there are no changes, sqlcompare.exe should return 63.David Atkinson
Product Manager
Redgate Software