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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SQL query with different parameter

Author  Topic 

sanjay_jadam
Yak Posting Veteran

53 Posts

Posted - 2005-12-20 : 00:54:34
I have a dropdown list in my user interface called Prequalified
this dropdown shows value (blank,Yes,No)

when user don't select any value then dropdown value is blank

I have a table in which i have to field PrequalifiedBy and PrequalifiedDate but i don't have any field which having yes/No or bit datatype

what i want to do is

1 when user select blank then i want to show all record from my table
2 when user select No then i want to select those row whose PrequalifiedDate and PrequalifiedBy is empty or NULL
3 when user select Yes then i want to select those row whose PrequalifiedDate and PrequalifiedBy is not empty or NULL.
(means there is some value)

please solve these problem without using EXEC
and xp_executesql


Please help me

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2005-12-20 : 01:13:07
Something like this . . .
where 
(
@userselect = 'blank'
or (@userselect = 'No' and PrequalifiedDate is NULL and PrequalifiedBy is NULL)
or (@userselect = 'Yes' and PrequalifiedDate is NOT NULL and PrequalifiedBy is NOT NULL)
)



-----------------
[KH]

Learn something new everyday
Go to Top of Page

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2005-12-20 : 01:20:11
khtan,
i think this wont take care of blank records
try this..
where
(
@userselect = 'blank'
or (@userselect = 'No' and isnull(PrequalifiedDate,'')='' and isnull(PrequalifiedBy,'')='')
or (@userselect = 'Yes' and isnull(PrequalifiedDate,'')<>'' and isnull(PrequalifiedBy,'') <>'')
)
Go to Top of Page

sanjay_jadam
Yak Posting Veteran

53 Posts

Posted - 2005-12-20 : 01:22:40
its work fine

thanks a lot
Go to Top of Page
   

- Advertisement -