We still need more clarification. If all you need is a unique code then an auto-increment column in the detail would give a unique number to every detail entry. If you're looking to identify the string value itself then the MD5 hash of the string might work as your key. Although, just searching for the string value directly would accomplish that as well.... So, yeah, we need a little more clarification of what you are trying to actually accomplish.