SQL Server evaluates an expression that depends on cost estimation plan which doesnt always make sense with other programming languages.
declare @a int = 1, @b int = 0
print 'if @a = @b + 1 or @a/@b = 2'
if @a = @b + 1 or @a/@b = 2
print 'No Error'
print 'if @a/@b = 2 or @a = @b + 1'
if @a/@b = 2 or @a = @b + 1
print ' Error'
go
-- we should have got divide by zero error as parent_object_id is 0 but alas NO
select *
from sys.tables
select *
from sys.tables
where schema_id / parent_object_id >10
and object_id < 10

0 Comments.