• Adam Aspin (6/8/2010)


    Really interesting and well-written article, thank you.

    As a matter of interest, is it any faster (or in any other way better or worse) to create the hash value as part of the T-SQL Select statement, using code based on something like this:

    [font="Courier New"]SELECT HashBytes('MD5', FirstName + LastName) FROM [AdventureWorks].[Person].[Contact][/font]

    Of course you will have to use all the fields that you will be hashing on, and cast all values to (n)varchar, but I wondered if you had tried this, and if so, which appraoch gave better performance?

    There shouldn't be much difference in doing it this way, however I try to avoid doing string manipulation in SQL whenever possible as that can be a major drag on performance. That was the chief reason in deciding to do it in .Net.