I have table with a char primary key and a int type-field. In the primary key field 80% of the values only contain numbers and the 20% that don't can be filtered by the value of the type.To illustrate:select * from x_table where type != 5
would get me all the data where I only have numbers in the primary key.I want to be able to narrow down a certain set based on the primary key like this:select * from x_table where type != 5 and key between 10 and 20
Now here comes the difficult part. The type allows null values and I need records with null type to be included in the result set. This won't work.I tried this:select * from x_table where (type != 5 OR type is null) and key between 10 and 20
This gives and errorquote:
Conversion failed when converting the varchar value 'JADIJADA' to data type int.