I have a question related to matching strings in a MSSQL database. Basically, I have a table that contains ICD9 and CPT codes. The issue is that the format that these codes come in is usually incorrect (i.e. too many characters, missing decimal, etc...). I need to be able to lookup the description for each of these codes from a lookup table containing the correct code.
Because of the way these codes are structured I can do some type of "progressive" match to at least find the category of the code.
Lets say the correct code is something like: 306.98
And for this example lets pretend there are no other values between 306 and 307.
I would like to strip the decimal and look for a match, one character at a time, until one is not found. Then select the last matching string.
So 306,3069,3098, 306981, 3069812, etc... would match the string 306.98.
I hope that makes sense to everyone. I am not sure how I would even begin to do this, so any suggestion would be a great help.