ColdFusion md5 hash directy in MSSQL

by 4:21 AM 4 comments
Ever needed to compare a ColdFusion hash() directly in MS SQL? I did today and I knew I had accomplished this before but forgot how to do it. Searching the net and twitter I came to some dead end or longish solutions. I knew Steve Good and I worked this out once before but I also remember there being an easier way.

Well there is and here is where I took the solution from:

The funny thing is I found this nearly a year ago and actually commented on the post just forgot all about it.

The result:


  1. So given that CF has the ability to create a hash effortlessly, what would be a real world scenario where you would want SQL server doing the hashing?

  2. I had a series of string in a table. To gain a little extra performance on selects I have a hash of each string with an index. I needed to get the hash of a string directly in enterprise manger to confirm some entries.

  3. Another good use case would be if you wanted to eliminate duplicates in a query. Pass in a CF hash to the where statement