Declare @ f1 int, @ v1 int
Set @ f1 = null
Set @ v1 = null
If @ f1 = @ v1 or (@ f1 is null and @ v1 is null) print 'same 'else print' different'
If @ f1 <> @ v1 or (@ f1 is null and @ v1 is not null) or (@ f1 is not null and @ v1 is null)
Print 'different 'else' print 'identical'
Print '------------------------------------------'
Set @ f1 = 1
Set @ v1 = 1
If @ f1 = @ v1 or (@ f1 is null and @ v1 is null) print 'same 'else print' different'
If @ f1 <> @ v1 or (@ f1 is null and @ v1 is not null) or (@ f1 is not null and @ v1 is null)
Print 'different 'else' print 'identical'
Print '------------------------------------------'
Set @ f1 = 1
Set @ v1 = null
If @ f1 = @ v1 or (@ f1 is null and @ v1 is null) print 'same 'else print' different'
If @ f1 <> @ v1 or (@ f1 is null and @ v1 is not null) or (@ f1 is not null and @ v1 is null)
Print 'different 'else' print 'identical'
Print '------------------------------------------'
Set @ f1 = null
Set @ v1 = 1
If @ f1 = @ v1 or (@ f1 is null and @ v1 is null) print 'same 'else print' different'
If @ f1 <> @ v1 or (@ f1 is null and @ v1 is not null) or (@ f1 is not null and @ v1 is null)
Print 'different 'else' print 'identical'
Print '------------------------------------------'
Set @ f1 = 0
Set @ v1 = 1
If @ f1 = @ v1 or (@ f1 is null and @ v1 is null) print 'same 'else print' different'
If @ f1 <> @ v1 or (@ f1 is null and @ v1 is not null) or (@ f1 is not null and @ v1 is null)
Print 'different 'else' print 'identical'
Print '------------------------------------------'
Solve the error caused by Null in logical operations