This simple query throws the “Ambiguous column name TaskID” error on one db-server only. This is ridiculous. We tested this with the same database structure on different servers and different versions of SQL Server (2005 / 2008), and it’s only THIS particular client’s server that throws the error. I’m actually frustrated.
SELECT Tasks.TaskID
FROM Tasks
INNER JOIN TaskHelpers ON TaskHelpers.TaskID = Tasks.TaskID
ORDER BY TaskID
Yes, I know I can put Tasks.TaskID into the order by clause, but for some reasons I can’t.
Wow. The problem was with the database compatibility mode. It was set to “80” (sql 2000). I’ve set it to 90 and the query works fine now.
More info on compatibility levels can be found here:
http://msdn.microsoft.com/en-US/library/ms178653(SQL.90).aspx