“Ambiguous column name” error on one particular server

前端 未结 6 726
隐瞒了意图╮
隐瞒了意图╮ 2020-12-18 03:18

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 structu

6条回答
  •  别那么骄傲
    2020-12-18 03:49

    You will get the ambiguous column name error if you run your query on sql server 2000, or under compatibility level 80 or less. On sql server 2005/2008 with compatibility level 90 or better, yur query runs fine.

    From the order by clause docs:

    "In SQL Server 2005, qualified column names and aliases are resolved to columns listed in the FROM clause. If order_by_expression is not qualified, the value must be unique among all columns listed in the SELECT statement."

提交回复
热议问题