FIX: Use of the RIGHT Function Within an ANSI Join FailsID: Q193757
|
Using the RIGHT function within an ANSI join clause fails with a syntax error on servers with SQL Server 6.5 Service Pack 3 or Service Pack 4 installed.
To work around this problem, do either of the following:
Microsoft has confirmed this to be a problem in SQL Server version 6.5 Service Pack 3 and Service Pack 4. This problem has been corrected in the latest U.S. Service Pack 5a for SQL Server version 6.5. For more information, contact your primary support provider.
The following is an example of a query that demonstrates this problem:
SELECT a.au_lname, t.title_id
FROM authors a JOIN titleauthor t
ON right(t.au_id,11) = right(a.au_id,11)
The following error is generated:
By recoding the query to use traditional join syntax, the problem does not occur:Msg 156, Level 15, State 1
Incorrect syntax near the keyword 'right'.
SELECT a.au_lname, t.title_id
FROM authors a, titleauthor t
where right(t.au_id,11) = right(a.au_id,11)
Additional query words: prodsqlsp sp3 sp4 sp5
Keywords : SSrvTran_SQL kbbug6.50 kbbug6.50.sp3 kbbug6.50.sp4 kbfix6.50.SP5
Version : winnt:6.5 Service Pack 3 and later,6.5 Service Pack 4 and later
Platform : winnt
Issue type : kbbug
Last Reviewed: May 4, 1999