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 2008 Forums
 Transact-SQL (2008)
 Select Statement

Author  Topic 

macca
Posting Yak Master

146 Posts

Posted - 2011-12-19 : 09:13:26
I have a field in table1 called appeal and it is a BIT data type. All values in Appeal by default are False unless set to True.

I am querying Table1 and I want to return all records where Appeal is False.

SELECT * FROM TABLE1
WHERE Appeal = 'False'

My code throws an error.
Anyone know the correct code?

Thanks

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-12-19 : 09:22:53
Valid values for a bit column are 0 (for false by convention), 1 and null. So use
SELECT * FROM TABLE1
WHERE Appeal = 0
Go to Top of Page

macca
Posting Yak Master

146 Posts

Posted - 2011-12-19 : 09:32:34
Thanks Sunita.

That worked.
Go to Top of Page
   

- Advertisement -