I have to create a search query for various fields. The search string is type varchar and all of the fields in a table are varchars of different lengths. The problem is two fields FEIN and ERN store mostly numeric data. I cannot change the data types and I have tried to cast the varchar as an int in my where clause but I get an error. An example of a FEIN could either be 11-1111111 or 111111111. ERN are always 7 digits. Can anyone assist me?
Miracle by Design
WHERE ((Cast(FEIN as int)) = cast(@Criteria as int) and a.JTAppID is not null)