For some reason, my query is generating an "invalid column name" error on only one server out of many.
I do not want to post the entire query as it is too large but this query here sums up where I'm getting at:
SELECT A.COL1, A.COL2 AS WORD, B.COL4
FROM A
INNER JOIN B ON B.COL1 = A.COL1
ORDER BY A.WORD
I know that the error is being generated by the use of an Alias in the Order By clause paired with the Table Name. It runs fine if I either remove the table name or if I use the original column name. However, as it is, this type of query runs fine on most other servers. I know it is not the version of the SQL Management Studio because I have tried it on a server with the same version and it executes just fine.
Is there a setting somewhere in the SQL Server that would prevent the pairing of
<table name>.<column alias> in the order by clause?
Start Free Trial