I must be missing something silly, and it's driving me around the bend:
With SQLServer 2K, I can only get rudimentary linkedserver use.
At best, only simple paths (server...table) workl.
(server.database.schema.table) does not.
Perhaps the nature of what currently "works" for me will give a clue as
to where I'm going wrong:
----------
I'm using single instances of SQL 2000 Server on two servers: WEBDB3 and
MGRDB.
I want to query WEBDB3 from MGRDB. If I had a dream query, it would be:
SELECT * FROM WEBDB3.DB9876..ACCOUNT(NOLOCK)
Yes, I know optimizer hints don't "travel" :-)
----------
WHAT WORKS ... SORT OF:
To remove all extraneous incompatibilities, I reduced this to a
loopback, where the 'local' and 'remote' servers are just one machine.
To not lose the flavour of what I'm trying, I've left the two server
names in this example; however, all tests were done on WEBDB3 linking to
WEBDB3..
On WEBDB3: sp_configure "remote login",1
In WEBDB3.Master: sp_addlogin 'MGRUSER','COMMON','password'
In WEBDB3.DB1234: sp_adduser 'MGRUSER','MGRUSER','db_owner'
On MGRDB:
(In ODBC Admin) create a SQLServer ODBC DSN ('DSWEBDB3') with default
db=COMMON.
(Via SQL EntMgr) create a linked server LSWEBDB3 with:
Type: OLEDB Provider for ODBC
Data source: DSWEBDB3
Catalog: DB1234
Provider Options:
+ Level zero only
+ Allow InProcess
Security: No mapped logins; default for unmapped logins is remote
login with MGRUSER/password.
Server Options:
+ Data access
+ Use remote collation
AND ...
sp_linkedservers shows provider MSDASQL for the above (and SQLOLEDB
below)
sp_helplinkedsrvlogin shows LSWEBDB3 with local login=null,
isselfmapped=0, remote login=MGRUSR.
In EntMgr: clicking on (Tables) shows 175 items, which is correct for
DB1234
In Query Analyzer: "select count(*) from LSWEBDB3...sysobjects" returns
the right number for DB1234.
BUT ....
"select count(*) from LSWEBDB3.DB1234.DBO.sysobjects" fails with:
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.
The provider did not give any information about the error.
(after a 10-sec delay)
If I omit 'Level zero only' from Provider Options, then "select
count(*) from LSWEBDB3..sysobjects" returns:
"Invalid schema or catalog specified for provider 'MSDASQL'."
If I use 'OLEDB Provider for SQL Server', the "select count(*)..."
returns
Server: Msg 7314, Level 16, State 1, Line 1
OLE DB provider 'LS2' does not contain table 'sysobjects'.
The table either does not exist or the current user does not have
permissions on that table.
If I use Server Type 'SQL Server' instead of an OLEDB provider, "select
count(*)..." returns:
SQL Server does not exist or access denied. (after a 20-sec
delay)