SQL..这个SQL语句居然会错???

来源:百度知道 编辑:UC知道 时间:2024/06/28 11:56:55
select table_name from adventureworks.information_schema.tables

就这个,查询adventureworks中的所有表名称,换成别的任何数据库都行,就这个数据库不行,在对象资源管理器中明明能看到它,use adventureworks 也能执行,而且我保证它的名称没有打错,但是请问高手,为什么查询它的时候会报"对象名 'adventureworks.information_schema.tables' 无效。"的错.

谢谢!

USE [AdventureWorks]
SELECT [Table_Name]
FROM [Information_Schema].[Tables]

可能你的用户有问题。不过你的原SQL确实没什么问题。
SELECT [Table_Name]
FROM [AdventureWorks].[Information_Schema].[Tables]

select table_name from adventureworks..information_schema.tables
是不是2点?,没用过不知道