Skip to content
Advertisement

Tag: binary

Hamming weight/population count in T-SQL

I’m looking for a fast way to calculate the hamming weight/population count/”the number of 1 bits” of a BINARY(1024) field. MySQL has a BIT_COUNT function that does something like that. I couldn’t find a similar function in T-SQL? Or would you suggest storing the binary data in a field of another type? If you don’t know what I’m talking about,

Advertisement