tags:

views:

153

answers:

1

Hi guys,

I'm using a field in a table to hold information about varios checkboxes (60).

The field is parsed to a string to something like this

"0,0,0,1,0,1,0,1,..."

Now I want to make a search using a similar string to match the fields. I.e.

"?,?,1,?,?,1,..."

where the "?" means that it must be 0 or 1 (doesn't matter), but the "1" must match.

As i've seen the '%' is somewhat innapropriate for this case, don't?

Obviosly both strings have the same lenght.

Suggestions?

thx.

+5  A: 

You can use the underscore (_) character to match a single character in the mask.

Taken from MySQL documentation.

scwagner
Same for MS SQL Server
Craig Young