“不明确的列名"一台特定服务器上的错误 [英] "Ambiguous column name" error on one particular server

查看:25
本文介绍了“不明确的列名"一台特定服务器上的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个简单的查询会在仅在一台数据库服务器上抛出不明确的列名称 TaskID"错误.这是荒唐的.我们在不同的服务器和不同版本的 SQL Server (2005/2008) 上使用相同的数据库结构对此进行了测试,只有这个特定客户端的服务器才会引发错误.我真的很沮丧.

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

是的,我知道我可以将 Tasks.TaskID 放入 order by 子句中,但由于某些原因我不能.

Yes, I know I can put Tasks.TaskID into the order by clause, but for some reasons I can't.

推荐答案

哇.问题在于数据库兼容模式.它被设置为80"(sql 2000).我已将其设置为 90,现在查询工作正常.

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.

可以在此处找到有关兼容性级别的更多信息:http://msdn.microsoft.com/en-US/library/ms178653(SQL.90).aspx

More info on compatibility levels can be found here: http://msdn.microsoft.com/en-US/library/ms178653(SQL.90).aspx

这篇关于“不明确的列名"一台特定服务器上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆