all groups > sql server programming > december 2004 >
You're in the

sql server programming

group:

Interesting Filter Query


Interesting Filter Query babz
12/22/2004 10:29:02 PM
sql server programming:
Hi

I have table with the values 'true', 'false', '0', '1' ,'' and other
numeric values.

I want to exclude 'False', '0' and '' and return all the rows. How to get it.

Declare @T Table (Idy Int Identity(1,1), FieldValue Varchar(100))

Insert into @T (FieldValue) Values ('True')
Insert into @T (FieldValue) Values ('True')
Insert into @T (FieldValue) Values ('False')
Insert into @T (FieldValue) Values ('False')
Insert into @T (FieldValue) Values ('0')
Insert into @T (FieldValue) Values ('1')
Insert into @T (FieldValue) Values ('1')
Insert into @T (FieldValue) Values ('')
Insert into @T (FieldValue) Values ('500')
Insert into @T (FieldValue) Values ('1000')

--Select * from @T
Select * from @T
Where FieldValue = 'True' OR FieldValue = '1' --or --fieldvalue <> ''
OR CASE RTRIM(LTRIM(ISNULL(FieldValue ,''))) WHEN '' THEN 'FALSE' END <>
'FALSE'


Need Help

Thanx in Advance
Re: Interesting Filter Query babz
12/22/2004 10:53:15 PM
Exactly. Thanks a lot

[quoted text, click to view]
Re: Interesting Filter Query Steve Kass
12/23/2004 1:36:37 AM
Do you want this?

select * from @T
where FieldValue not in ('False', '0', '')

Steve Kass
Drew University

[quoted text, click to view]
AddThis Social Bookmark Button