Previous Topic

Next Topic

Inhoudsopgave

Book Index

Bits And The Value NULL

In ASE a bit always has the value 0 or 1. Bit fields and bit variables that have no value are treated as having the value 0.

In MS SQL Server, a bit can also have the value NULL.

Example 1

create table T_Left (a char(10), i int)

create table T_Right (i int, b bit)

insert into T_Left values ('A', 1)

select L.a, L.i, R.i, R.b from T_Left L left outer join T_Right R on L.i = R.i

drop table T_Left

drop table T_Right

 

L.a

L.i

R.i

R.b

ASE

A

1

NULL

0

MS SQL Server

A

1

NULL

NULL

Example 2

declare @b bit

select @b as b

 

b

ASE

0

MS SQL Server

NULL