简体   繁体   English

在T-SQL中引用另一个表不起作用

[英]Referencing another table in T-SQL not working

I've been running a query on a large number of servers, and on just three of them (SQL2000, SQL2005 AND SQL2008) the query fails. 我一直在大量服务器上运行查询,而在其中三个服务器(SQL2000,SQL2005和SQL2008)上,查询失败。 I've boiled it down to referencing a table in another DB. 我将其归结为引用另一个DB中的表。

SELECT * FROM MASTER.dbo.syslogins AS syslogins

Which works on 99% of the servers, but on the three gives: 可以在99%的服务器上运行,但是在三个服务器上可以:

Invalid object name 'MASTER.dbo.syslogins'

If I switch to the master DB and run 如果我切换到主数据库并运行

SELECT * FROM dbo.syslogins AS syslogins

Then it works. 然后就可以了。 I've also checked I have permissions by running 我还通过运行检查了我的权限

SELECT IS_SRVROLEMEMBER('sysadmin');

Which returns a 1. So why does referencing the MASTER.dbo.syslogins table fail? 哪个返回1。那么为什么引用MASTER.dbo.syslogins表失败?

Maybe the server is set up with a case sensitive collation. 也许服务器设置了区分大小写的排序规则。 Try 尝试

SELECT * FROM master.dbo.syslogins

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM