Return Bit Value as 1/0 and NOT True/False in SQL Server

Butters picture Butters · Jul 3, 2013 · Viewed 146.1k times · Source

I have a Table in SQL Server 2000 with BitValue Column. But, it is being displayed as True/False in SQL Server Management Studio. When I do a Select * from Tablename it returns the BitValue Column values as True/False. How do I force it to return the value as bits (1/0) instead of True/False? Any Help will be really appreciated?

Answer

Gaston Flores picture Gaston Flores · Jul 3, 2013

Try with this script, maybe will be useful:

SELECT CAST('TRUE' as bit) -- RETURN 1
SELECT CAST('FALSE' as bit) --RETURN 0

Anyway I always would use a value of 1 or 0 (not TRUE or FALSE). Following your example, the update script would be:

Update Table Set BitField=CAST('TRUE' as bit) Where ID=1