November 19, 2014 at 3:37 pm
I need to add a filter clause like
WHERE username = '%%%'
It needs NOT to filter anything out.
I know you will say 'why add a filter if you're not going to use it?' but I need to for a certain application which will use the parent query for child queries in which I select the specificity required for the child query's data set.
I've tried '%*%' and '%_%' but always it returns nothing. I need the filter to exist yet not really filter.
Is this possible?
November 19, 2014 at 3:37 pm
Try "LIKE" '%' rather than "=" :-).
SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.
November 19, 2014 at 3:51 pm
...
November 19, 2014 at 4:07 pm
I'm going to use Scott Pletcher's answer....Works for me!
if someone says it's not perfect, can you give more info?
November 19, 2014 at 4:33 pm
NULL will never be "LIKE" or "=" anything. To allow NULL values, you'd have to add:
WHERE (column_name LIKE '%' OR column_name IS NULL)
SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.
November 19, 2014 at 4:39 pm
Ah, that is exactly awesome! Thanks Scott!
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply