I have a diagnosis code field in a database with a datatype of text. some of the entries are just numbers and some start with a letter and all other characters are numbers.

I have categories that have ranges of codes that fit into them. for example one of my categories is all diagnosis codes that fall between 630.xx and 679.xx where xx could be any number. another would be 249.xx to 249.xx or 250.xx to 250.xx, or 295.xx to 300.xx, or E800.xx to E999.xx, there are a lot more than that but i wont burden you with all of them. I would like some help in wiriting queries using these ranges in a where clause.

Is it possible to use <, >, <=, >= with strings in a query? Or is there a better way to do this?