BINARY_CHECKSUM is not yielding expected value.
I have 2 tables with 20 columns in each.
16 of these columns have the same value and 4 do not, yet when I use BINARY_CHECKSUM it gives the same value.
Below is the data table.
Why are the checksum values not unique?
What alternative do I have to using BINARY_CHECKSUM ?
thanks!
SELECT BINARY_CHECKSUM(*) FROM #stg -- -1571139392
SELECT BINARY_CHECKSUM(*) FROM #facts -- -1571139392
source | #facts | #stg |
dim_receipt_date_id | -1 | 20210308 |
dim_dock_date_id | -1 | 20210308 |
dim_min_dock_date_id | -1 | 20210308 |
dim_max_dock_date_id | -1 | 20210308 |
fact_id | RMA3649121-1 | RMA3649121-1 |
order_nbr | RMA3649121 | RMA3649121 |
line_nbr | 1 | 1 |
dim_order_date_id | 20210217 | 20210217 |
dim_call_date_id | 20210217 | 20210217 |
dim_disposition_date_id | -1 | -1 |
dim_disposition_id | 3 | 3 |
dim_ship_date_id | -1 | -1 |
dim_credit_date_id | 20210308 | 20210308 |
dim_carrier_notify_date_id | -1 | -1 |
dim_carrier_delivery_date_id | -1 | -1 |
dim_carrier_collection_date_id | -1 | -1 |
dim_carrier_expected_collection_date_id | -1 | -1 |
dim_country_id | 28 | 28 |
dim_site_id | 735 | 735 |
dim_service_type_id | 49 | 49 |
SELECT HASHBYTES
('SHA2_256',
CAST( CONCAT(
fact_id,
order_nbr,
line_nbr,
dim_order_date_id,
dim_call_date_id,
dim_disposition_date_id,
dim_disposition_id,
dim_receipt_date_id,
dim_dock_date_id,
dim_ship_date_id,
dim_credit_date_id,
dim_carrier_notify_date_id,
dim_carrier_delivery_date_id,
dim_carrier_collection_date_id,
dim_carrier_expected_collection_date_id,
dim_min_dock_date_id,
dim_max_dock_date_id,
dim_country_id,
dim_site_id,
dim_service_type_id
) AS VARCHAR(MAX) )
) from #facts
--Result>>
from #stg -- 0x95B73644AFA7D6E3DD91D3CB3774F0D828B102676A94818F6A718C0CA5CF82BD
from #facts -- 0x52B8DB837F549278305E7BC5FAC1E4BD6CF8822BFC70761403572A978299B1C0