On Transact SQL language the bit is an integer data type that can take a value of 1, 0, or NULL. The string values TRUE and FALSE can be converted to bit values: TRUE is converted to 1 and FALSE is converted to 0.
Bit syntax:
bit
Bit example:
USE model;
GO
DECLARE @myVar1 bit;
DECLARE @myVar2 bit;
DECLARE @myVar3 bit;
SET @myVar1 = 3;
SET @myVar2 = 0;
SET @myVar3 = 1;
PRINT @myVar1;
PRINT @myVar2;
PRINT @myVar3;
GO
Results |
---|
1 |
0 |
1 |