Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Information Schema Query on linked server fails.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-10-31 : 18:52:15
Mohammed writes "Hi, We had a simple application which compared schemas on local servers. We are updating it to compare schemas across servers. Unfortunately the query which refers to the Information_Schema fails, and I cant find any syntax to make it work!

Here is the simplified version of the query.

SELECT 1 FROM [Matrix].[ReviewRecorder].[DBO].INFORMATION_SCHEMA.TABLES

tried the following combinations out of frustration, but none worked.
SELECT 1 FROM [Matrix].[ReviewRecorder].[INFORMATION_SCHEMA].TABLES

SELECT 1 FROM [Matrix].[ReviewRecorder].[DBO].[INFORMATION_SCHEMA].[TABLES]

Obviously Matrix is the name of the remote Database Server, and it has been linked already to the local Database.

The error i get is
------
The object name 'Matrix.ReviewRecorder.DBO.INFORMATION_SCHEMA.' contains more than the maximum number of prefixes. The maximum is 3.
------

sp_linkedservers shows
---------
Matrix SQLOLEDB SQL Server Matrix NULL NULL NULL
---------

HELP !

Thanks
Mohammed"

nr
SQLTeam MVY

12543 Posts

Posted - 2005-11-01 : 12:53:08
exec [Matrix].[ReviewRecorder].dbo.sp_executesql N'select * from INFORMATION_SCHEMA.TABLES'

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -