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:
00645549
Views:
23
>>Is this QBE?
>>
>>If so, what you have is the simpliest approach. The only danger is in the fact that you've exposed your database schema to application. Maybe even hardcoded things like table and column names, data types, and relationships?
>>
>>-Mike
>
>
>The field names are part of a Dictionary (SQL table). So are the table names and their relationships. VFP is used as a presentation layer only, calling stored procs. for the rest.
>
>Optimizing these queries however is another undertaking. I basically have two types of fiels:
>a) single value fields (like: A, D, F, etc.) which are indexed and perform well.
>b) multi-value Yes/No fields coded as binary numbers: 0010010010. The only way to extract the values is using: SUBSTRING(field, loc, 1) = '1'. Obviously indexing does not help here. These queries take long to execute. I tried converting the binary numbers to decimals and then somehow query numeric ranges, but I saw no improvement. I have fields that are 80 chars long, so they cannot be converted to numeric values either. Any other suggestions?

You can query multi-value character fields using LIKE operator.
-- field '0010010010'
...
   WHERE myfield LIKE '1?1????????'
-- or
   WHERE myfield LIKE '1?1%'
It'll make query simpplier but wouldn't speed it up in most cases.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform