Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic Where Clause In Stored Procedure
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00634614
Message ID:
00647522
Views:
28
>Are the Multi-value Yes/No fields true binary columns or character columns filled with 0's and 1's?
>
>Are there too many Yes/No fields that you can't break them into seperate columns?
>
>Maybe instead of using all the SUBSTRING() functions, you could combine all the required Yes/No fields into a single constant literal. For example, say that the user wants the all the columns where the value in position 2 and 3 are set. Instead of doing:
>
>WHERE SUBSTRING(field, 2, 1) = '1' AND SUBSTRING(field, 3, 1) = '1' ...
>
>You could do something like this:
>
>WHERE field = '011000 ... 0'
>
>Same thing with true binary values.
>
>-Mike

Michael,
The fields are character fields. I tried converting them into binary (those that are not over the bit limit of a binary number), but saw no improvement in speed.

There could be a few Yes/No fields (10 or 20), that would multiply if I were to break them down into mulitples, but, more impoertantly, they would make the querying complex.

How would WHERE field = '011000 ... 0' substitute the SUBSTRING function? I am not sure I understand.
Aristotle
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform