travisbrown
Technical User
- Dec 31, 2001
- 1,016
I seem to have come across this before, but can't remember what I did as a solution. It is a prtty simple problem, I think.
Is there a way to use wildcards on a int column? I have a sp where the variable for the filter on the int column may or may not have value.
WHERE intcol = @intvar
@intvar might be "%" or it might be a valid int value.
The quickest workaround I can think of is
WHERE cast(intcol, varchar(50)) LIKE @intvar
Basically, if there is no value for @intval, I want to return all records
Is there a way to use wildcards on a int column? I have a sp where the variable for the filter on the int column may or may not have value.
WHERE intcol = @intvar
@intvar might be "%" or it might be a valid int value.
The quickest workaround I can think of is
WHERE cast(intcol, varchar(50)) LIKE @intvar
Basically, if there is no value for @intval, I want to return all records