I am trying to execute and SQL Query in SQL Server 2005 in order to return
all tables.
Whenever I execute this query:
select table_name from information_schema.tables
I receive this error each time:
Invalid object name 'information_schema.tables'.
Does anyone know what is happening? This seems to be a pretty standard
query to return all tables from what I have read.
--TR
SQL Server Version Info:
Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52
Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT
5.1 (Build 2600: Service Pack 2)Maybe you have case sensitive collation. Try this:
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
Also, the query below should give you the same info:
SELECT O.name AS table_name
FROM sys.objects AS O
WHERE O.type = 'U';
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||Is your database case sensitive? If so, you'll need to execute this query:
select table_name from INFORMATION_SCHEMA.TABLES
-Susan
"Ryan" wrote:
> I am trying to execute and SQL Query in SQL Server 2005 in order to return
> all tables.
> Whenever I execute this query:
> select table_name from information_schema.tables
> I receive this error each time:
> Invalid object name 'information_schema.tables'.
> Does anyone know what is happening? This seems to be a pretty standard
> query to return all tables from what I have read.
>
> --TR
> SQL Server Version Info:
> Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52
> Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT
> 5.1 (Build 2600: Service Pack 2)
>
No comments:
Post a Comment