• wow, I am in awe (assuming it works 🙂 ). I would venture a guess that this is, indeed, the most efficient solution.

    One fix required here is to separate the identifier from the name in the hash, otherwise "MyName1" with identifier 6 could be confused with "MyName" with identifier 16.

    http://poorsql.com for T-SQL formatting: free as in speech, free as in beer, free to run in SSMS or on your version control server - free however you want it.