Answer: 'Bit' is one of the integer or numeric data types in SQL Server that can have either 1, 0, or NULL value.
Actually,Bit datatype is used for storing boolean value like 1 or 0.1 for true and 0 for false.
Generally,we use Bit data type to check whether user account or employee is Active or In-Active.
We can use it like a
BOOLEAN variable.
For Example:-
create table Employee_Master
(
employee_id int,
employee_name varchar(200) not null,
is_active bit
)
When we insert a record in Employee_Master table,SQL Server stores 0,1 or Null value in the is_active column.
Asked In: Many Interviews |
Alert Moderator