Open mariomuja opened 3 years ago
I think you can get almost the same result with diff tools other than WinMerge.
WinMerge shows "master_policy_number" (left side) and "quotation_id" (right side) in the same row. "master_policy_number" is missing on the right side - therefore, I expected a blank row on the right side. "quotation_id" is missing on the left side - therefore, I expected a blank row on the left side.
The result you expected probably comes from your knowledge of how the file on the left was modified to the right (or vice versa).
But someone who does not know that might think that someone just replaced Master_policy_number with quotation_id and changed the type.
Similarly, almost diff tools do not create comparison results based on the meaning of the lines, how they changed, or whether the lines are similar. Simply calculate the hash value for each line, find the line with the matching hash value, and follow the diff algorithm to adjust for the smallest difference.
In the future, AI-powered diff tools may give the expected results, but WinMerge hasn't reached that level yet.
thanks a lot for your answer!
I found that comparison of SQL scripts often leads to wrong results. For an example, please see the enclosed screenshot.
WinMerge shows "master_policy_number" (left side) and "quotation_id" (right side) in the same row. "master_policy_number" is missing on the right side - therefore, I expected a blank row on the right side. "quotation_id" is missing on the left side - therefore, I expected a blank row on the left side.
For sales_date it works correctly and shows the blank row for the missing column on the other side.
Why is the behaviour different for these cases?
-- EDIT:
Please find the compared text below.
Left Side:
USE [core] GO
/** Object: Table [dbo].[dim_policy_motor] Script Date: 2021-07-13 09:10:09 **/ SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON GO
CREATE TABLE [dbo].[dim_policy_motor]( [dim_id] [int] IDENTITY(1,1) NOT NULL, [partner_dim_id] [int] NOT NULL, [contract_dim_id] [int] NOT NULL, [portfolio_dim_id] [int] NOT NULL, [underwriting_year_dim_id] [int] NULL, [policy_id] [int] NULL, [policy_number] nvarchar NOT NULL, [technical_line_of_business_dim_id] [int] NULL, [master_policy_id] [int] NULL, [master_policy_number] nvarchar NULL, [enquiry_date] [datetime] NULL, [quote_date] [datetime] NULL, [sales_date] [datetime] NULL, [inception_date] [datetime] NULL, [policy_expiry_date] [datetime] NULL,
Right Side:
USE [core] GO
/** Object: Table [dbo].[dim_policy] Script Date: 2021-07-13 09:09:50 **/ SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON GO
CREATE TABLE [dbo].[dim_policy]( [dim_id] [int] IDENTITY(1,1) NOT NULL, [partner_dim_id] [int] NOT NULL, [contract_dim_id] [int] NOT NULL, [portfolio_dim_id] [int] NOT NULL, [underwriting_year_dim_id] [int] NULL, [policy_id] [int] NULL, [policy_number] nvarchar NULL, [master_policy_id] [int] NULL, [quotation_id] [int] NULL, [enquiry_date] [datetime] NULL, [quote_date] [datetime] NULL, [inception_date] [datetime] NULL, [policy_expiry_date] [datetime] NULL,