...

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



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

tblProducts:

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?

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum