Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query Prompting

Author  Topic 

pungigi
Starting Member

5 Posts

Posted - 2010-08-17 : 10:16:09
I have a query and I need to be able to prompt for 3 pieces of information, see below.

WHERE
(ccg.Name = 'MCG - Grays Harbor Comm Hosp' or
c.customer = xxxxxxxx)
AND C.COB = '00500 - Early Out Clients'

c.cob is ALWAYS needed, however, if they fill in ccg.name then c.customer can be blank or vice versa, however, there are multiple c.customers for a ccg.name so if they choose ccg.name I need it to grab all the c.customers under it. I really hope this makes sense.

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-08-17 : 10:18:45
Refer to this link

http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-17 : 10:22:34
what do you mean by prompt? if you are looking for interface which would ask user to enter value for parameters then its not possible in SQL. you need to do it at your application side or use reporting tools
for making parameters optional add a OR logic like



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -