1

I just saw the weirdest thing ever in some very old SQL code we have.

There is a multiply equals operator in a where clause. Does it have a special meaning? It selects the appropriate columns, but o.name is NULL.

I am sure it is a typo, but I just want to confirm.

select  c.name,
        c.status,
        o.name
from    syscolumns c,
        sysobjects o
where   c.id = object_id('dbo.MyTable')
and     c.cdefault *= o.id
order by colid asc
Peet Brits
  • 2,911
  • 1
  • 31
  • 47

3 Answers3

0

This question was already answered here: SQL Server *= Operator?

Beyond being the oldschool way, as fancyPants mentioned, it also may not always work consistently. You should revise your SQL statement to include the JOINS in the FROM clause.

To answer your question: *= is a LEFT OUTER JOIN, while =* is a RIGHT OUTER JOIN

Community
  • 1
  • 1
Jem
  • 4,313
  • 2
  • 18
  • 20
0

As mentioned, this is a LEFT OUTER JOIN. Similarly, =* is a RIGHT OUTER JOIN

That said, it shouldn't be used anymore, and you should use the full syntax.

Tom
  • 7,640
  • 1
  • 23
  • 47
0
*= (LEFT OUTER JOIN)

=* (RIGHT OUTER JOIN)
Flavia Obreja
  • 1,227
  • 7
  • 13