SQLTeam.com | Weblogs | Forums

Update if any one column changes



I am thinking of using BINARY_CHECKSUM(*) to check for changes on source table to compare with destination table in an ingest (ETL) process.

So when doing BINARY_CHECKSUM(*) is it doing over all columns in the table or the column in the select statment?

SELECT name, lastname, 
BINARY_CHECKSUM(*) bchecksum
FROM [IntegrationStaging].[dbo].SourceTable


Yes except for certain data types. It can't compare text, ntext, image, cursor, xml and noncomparable common language runtime (CLR) user-defined types, according to the SQL Server Documentation


So it is a Yes to which one :slightly_smiling_face:
Over all of the columns in the source table or only the columns in the select statement?

Thanks Joseph!


From the link I posted to the Docs:
Specifies that the computation is over all the columns of the table. So


returns a checksum for all comparable columns, Whereas

SELECT BINARY_CHECKSUM(MyFirstCol, MySecondCol) FROM dbo.MyTable; 

would create a checksum for just the listed columns.


ahh!! of course. wow had a long day was staring at my screen for too long.

Thanks Joseph!