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)
 WTF with OPENQUERY?

Author  Topic 

MuadDBA

628 Posts

Posted - 2003-02-07 : 14:40:46
I used an openquery statement:

select * from OPENQUERY(IMGDEVOCRDB1,'select * from loan')

And I get the following error:

Server: Msg 155, Level 15, State 1, Line 1
'IMGDEVOCRDB1' is not a recognized OPTIMIZER LOCK HINTS option.

WTF? That server is in my linked servers, I can query it normally, why can't I use the openquery?


I am using SQL 7.0 SP3


Edited by - crazyjoe on 02/07/2003 14:41:37

1fred
Posting Yak Master

158 Posts

Posted - 2003-02-07 : 14:51:33
When you query a linked server, you need to do it like this : select * from LinkedServer.DB.User.Table.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-02-07 : 14:51:40
From MS' knowledge base:
[url]http://support.microsoft.com/default.aspx?scid=kb;en-us;200797[/url]

Go to Top of Page

MuadDBA

628 Posts

Posted - 2003-02-07 : 14:54:41
Thanks guys, I did search MS on the topic, but it came back with a bunch of unrelated articles.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-02-07 : 15:06:26
quote:

When you query a linked server, you need to do it like this : select * from LinkedServer.DB.User.Table.



That's incorrect. You can do it either way.

SELECT * FROM SERVER1.Database.dbo.Table1
OR
SELECT * FROM OPENQUERY(SERVER1, 'SELECT * FROM Databse.dbo.Table1)

They both provide the same result set.

Go to Top of Page

MuadDBA

628 Posts

Posted - 2003-02-07 : 17:07:24
yep, it was not the query it was the db compatibility level of the database.

Go to Top of Page
   

- Advertisement -