View Full Version : How to write where clause for a Bit column?

12-12-2006, 03:44 PM
I have a table which has the following columns with data types:


ProductID int
ProductName nvarchar
IsValue bit (its either 0 or 1)
Rank nvarchar

So when I write a select statement how should I set the value for IsValue - meaning with single quotes or without any quotes as follows:

SELECT ProductID, ProductName, IsValue
FROM tblProducts
WHERE IsValue = 0 ORDER BY Rank

Is the above one correct or I should put the 0 within quotes or any other way?

12-12-2006, 03:52 PM
SQL Server needs no quotes for bit fields; so if that's your DBMS, there you are.

12-12-2006, 04:06 PM
Thanks nikkiH