If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Dynamic Where clauses ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-26-10, 02:13
asp_crazy_guy asp_crazy_guy is offline
Registered User
 
Join Date: Mar 2009
Posts: 73
Thumbs up Dynamic Where clauses ?

Hi I have a crystal report with a query that can have 'multiple' or 'no' 'where' clauses,

For e.g. the query can be

select * from tableA or
select * from tableA where ID={?ID} AND name={?name}


What is the best and recommended way to write such a query so it can accommodate the dynamic where clauses?

I know about select * from tableA where 1=1 {?parameter}

and I pass the parameter like
"AND id=1 AND name='john'

But is this approach the right way? I read it causes performance problems. Please advice as necessary.

Thanks, Mike.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On