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
 SQL Server Development (2000)
 Selecting data from a linked server.

Author  Topic 

stango
Starting Member

8 Posts

Posted - 2004-08-19 : 13:36:15
SQL 2k running in 6.5 compatability

I realize that these questions may be easy, but I have searched for answers and not found anything yet so any help will be appreciated.

I have successfully created a linked server to an excel spreadsheet, and I can select from this while in the Master db from query analyzer using the following syntax:

select * from openquery(noflylist,'select * from [sheet1$]')

As soon as I try to run the same thing in q/a of another db on the same server as the master is, I get the following error:

'noflylist' is not a recognized OPTIMIZER LOCK HINTS option.

I am assuming that I do not have the correct server.dbo.db.table syntax, but cannot figuire out what to do.

When I try the above syntax, I get an error telling me .'s arent allowed.

So is there something obvious I am missing here. It should be pretty straight forward to select from a table or object in a linked server, no matter what db I am in.

Also, how do I view all of the objects in a linked table. I cant pin this one down as well.

Thanks,
sTango



tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-19 : 14:52:26
Never used openquery before, but try select * from master..openquery(...).

BTW, you have the order of the naming convention incorrect:

ServerNameOrLinkedServerName.DBName.ObjectOwnerName.ObjectName


Tara
Go to Top of Page

maydo
Starting Member

20 Posts

Posted - 2004-08-20 : 02:04:16
The error occurs if you have changed the compatibility level of a SQL Server 7.0 database to 6.5 version.

I assume you didn't change the compatibility level for master db and that's why the query still runs there.


http://support.microsoft.com/default.aspx?scid=kb;EN-US;q200797
Go to Top of Page

stango
Starting Member

8 Posts

Posted - 2004-08-20 : 09:30:33
Thanks for the info guys. I appreciate it.
Go to Top of Page
   

- Advertisement -