3.5. Exploring Alternative Syntax for Joins

What we're going to look at in this section is what many people still consider to be the "normal" way of coding joins. Until SQL Server 6.5, the alternative syntax we'll look at here was the only join syntax in SQL Server, and what is today called the "standard" way of coding joins wasn't even an option.

Until now, we have been using the ANSI syntax for all of our SQL statements. I highly recommend that you use the ANSI method since it has much better portability between systems and is also much more readable. It is worth noting that the old syntax is actually reasonably well supported across platforms at the current time, but the ANSI syntax is now also supported by every major platform out there.

The primary reason I am covering the old syntax at all is that there is absolutelyno doubt that, sooner or later, you will run into it in legacy code. I don't want you staring at that code saying, "What the heck is this?" That being said, I want to reiterate my strong recommendation that you use the ANSI syntax wherever possible. Again, it is substantially more readable, and Microsoft has indicated that it may not continue to support the old syntax indefinitely. I findit very hard to believe, given the amount of legacy code out there, that Microsoft will dump the old syntaxany time soon, but you never know.

Perhaps the biggest reason is that the ANSI syntax is actually more functional. Under old syntax, it was actually possible to create ambiguous ...

Get Professional SQL Server™ 2005 Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.