Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Deprecated JOIN Syntax

Author  Topic 

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-14 : 06:11:38
Hello mates,
does anyone know a date or a SQL Server version where the deprecated join syntax like this:

select elephant
from afrika, india
where afika.animalTypeId = india.animalTypeId

will not longer work anymore?

Thx
Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.

Kristen
Test

22859 Posts

Posted - 2010-04-14 : 06:48:35
JOIN using

FROM TableA AS A, TableB AS B
WHERE A.ID = B.ID

is still supported in SQL 2008 (i.e. compatibility mode 100)

However, the SQL-92 "*=" syntax for Outer Joins i.e.

FROM TableA AS A, TableB AS B
WHERE A.ID *= B.ID

is not supported in SQL2005 (i.e. in compatibility mode 90) and later
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-14 : 07:53:41
Hello Kristen,

thank you, I do know that.
It seems like it is not sure if the next version or next next version of SQL Server is not supporting this kind of join.

A colleague asked me "Should I start and change the syntax in every SP?"
My answer was "Do it in every SP that comes across while you are doing your job, because I don't know a deadline."


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-04-14 : 08:17:00
I don't see anything in BoL 2008 that says that JOIN in WHERE clause is deprecated (I have not read it cover-to-cover though!) but if I have got that right it will not be removed in next version (i.e. no warning yet).

I wonder if they need to retain this style of INNER JOIN anyway because you can do

FROM TableA AS A
JOIN TableB AS B
ON B.ID = A.ID
WHERE A.OtherColumn = B.OtherColumn

otherwise they would have to mandate that all JOIN'd columns were in the JOIN clause .... so maybe that is why it is not removed yet, even though they have removed the "*=" OUTER JOIN syntax?

Anyway, high time you got rid of the old style code! so I think that "every time you come across one fix it" is a good plan.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-14 : 08:53:21
[code]
-- Example 1: Deprecated syntax for an inner join
SELECT [T2].[c3], [T1].[c3]
FROM [dbo].[Table2] T2, [dbo].[Table1] T1
WHERE [T1].[ID] = [T2].[ID]
[/code]

Source: http://msdn.microsoft.com/en-us/library/dd172122.aspx


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-04-14 : 09:26:45
I don't think that page tells you much Fred. Support for the "*=" syntax was already removed some time ago (SQL2005) but no mention is made of that on that page (i.e. it seems to imply that its deprecated and should not be used, rather than actually not being valid any more!.

OTOH the equi-join syntax is still supported in SQL 2008 and is not documented in BoL 2008 as being deprecated [or I failed to find the reference].

I could find NO mention of "*=" syntax in BoL 2008, so there isn't, for example, a page explaining that "*=" has already gone and providing a documentation opportunity on the life expectancy of the old equi-join syntax.

So I surmise that there are no plans to remove equi-join "=" soon.

Presumably Upgrade Advisor will warn about them (or a future version will, when it is deprecated) which will give you a means of finding & fixing any that are still left behind?
Go to Top of Page

dportas
Yak Posting Veteran

53 Posts

Posted - 2010-04-18 : 09:03:48
SELECT elephant
FROM afrika, india
WHERE afika.animalTypeId = india.animalTypeId

This syntax has never been deprecated. It is part of the current ISO SQL Standard and as such is unlikely ever to be desupported.

The *= / =* syntax IS deprecated and is no longer supported except in backwards compatibility mode (and it never was part of the SQL standard anyway).
Go to Top of Page
   

- Advertisement -