Actually there is a module that checks a database for given records thus this logic. But in one particular database it takes quite a bit of time so I was curious. It has a UPPER() code field and rest is desc and memo field for furhter details.
Regards
Bhavbhuti