rockenpeace
rockenpeace

Reputation: 1009

*= and =* sql operators

There are

*= and =*

sql equalities in my application queries. What does it mean? I have investigated on google but i could not find sufficient information. For example :

SELECT ODR_YO_ID, OGR_OKUL_NO, OGR_ADI+' '+OGR_SOYADI OGR, COUNT(ODR_YO_ID) SAYI
FROM OGRENCI,YIL_SUBE,YIL_OGRENCI, OGRENCI_DAVRANIS 
WHERE  ODR_OLUMLU = 1 AND YO_OGR_ID = OGR_ID AND  ODR_YO_ID = YO_ID AND YO_AKTIF = 1 AND 
YO_YSB_ID = YSB_ID AND  YSB_ID = 2183 AND YSB_YIL_KOD *= ODR_YIL_KOD AND  ODR_OGR_ID =* OGR_ID  
GROUP BY ODR_YO_ID, OGR_OKUL_NO, OGR_ADI+' '+OGR_SOYADI, YO_OKUL_DEGIS_TARIHI 
ORDER BY OGR

When i execute this sql query in my local computer, i take this error:

 Msg 102, Level 15, State 1, Line 5
 Incorrect syntax near '*='.

But i run same query in related server, this query works without any error.I use sql server 2012 express edition in my local computer and there is sql server 2005 in related server. Why ? Thanks in advance.

Upvotes: 3

Views: 3471

Answers (1)

podiluska
podiluska

Reputation: 51494

*= was the ANSI-89 syntax for a left join. It is now deprecated which is why you get the error.

Similarly =* is analogous to right join.

You need to move the join clauses from the where clause to the join syntax, but without knowing which tables the fields come from, I can't be more specific

ie

YSB_YIL_KOD *= ODR_YIL_KOD 

becomes

ysbtable 
    left join odrtable 
        on YSB_YIL_KOD = ODR_YIL_KOD 

and

ODR_OGR_ID =* OGR_ID

becomes

odrtable 
    right join ogrtable
        on ODR_OGR_ID = OGR_ID

You may be able to make the query work on your local machine by changing the database compatibility level ( http://technet.microsoft.com/en-us/library/bb510680.aspx ) but I would advise rewriting it to the current syntax.

Upvotes: 3

Related Questions