I am migrating a database from SQL Server 2005 to MS SQL Server 2012 and I came across this error message while running the application. (I am also upgrading the .NET Framework from 2.0 to 4.5 i know.. kind'a big jump ^_^.)
ERROR MESSAGE:
SQLException: Incorrect syntax near '*='.
I checked the stored procedure and found the culprit operator '*='.
Obviously, I am not the initial developer of this application because I don't know what operator is that. After a minute of research, I found out that this is an operator for the LEFT JOIN and the RIGHT JOIN. But '*=' and '=*' operators syntax has been obsolete since 1992. (No wonder I haven't heard of it. I started coding around 2000.) Luckily it is still work in SQL Server 2005.
SOLUTION:
So to fix this issue.. just replace to LEFT JOIN for '*=' and RIGHT JOIN for '=*'
EXAMPLE QUERY - BEFORE:
SELECT *
FROM tblPatient as A, tblInvoices as B
FROM tblPatient as A, tblInvoices as B
WHERE A.InvoiceId *= B.InvoiceId
EXAMPLE QUERY - AFTER:
SELECT *
FROM tblPatient as A LEFT JOIN tblInvoices as B
FROM tblPatient as A LEFT JOIN tblInvoices as B
ON A.InvoiceId = B.InvoiceId
L.





0 comments:
Post a Comment