A quick post today, I was a little surprised to find out that SQL Server would implicitly convert a string ‘true’ or ‘false’ when inserting into a bit(boolean) column.

create table dbo.TestTable(
RecordId int not null identity(1,1) primary key,
IsActive bit not null
)

insert into dbo.TestTable(IsActive) values (1);
insert into dbo.TestTable(IsActive) values (0);
insert into dbo.TestTable(IsActive) values ('True');
insert into dbo.TestTable(IsActive) values ('False');

select * from dbo.TestTable;