I have a linked server registered in my SQL Server 2005 which accesses our SAP database (test system). It uses an ODBC driver provided by SAP, and is connected using the Microsoft OLEDB For ODBC driver. The remote database is a MaxDB 7.7.
I'm currently exploring the possibilities of directly accessing data within our SAP system, but have run into problems regarding certain tables.
The following works without problems:
SELECT Field FROM LinkedServer..Schema.Table WHERE MANDT = '110'
or, respectively
SELECT * FROM OPENQUERY(LinkedServer, 'SELECT Field FROM Table WHERE MANDT = ''110''')
Now, there's some nasty table names within SAP that can contain slashes. I think it's meant to be a "namespace" type of thing contained within the actual table name. On the ABAP side of things, I can easily do
SELECT * FROM /MYWHATEVER/MYTABLE
provided the table exists. But I can't get the table names containing / working via linked server.
Trying
SELECT * FROM OPENQUERY(LinkedServer, 'SELECT * FROM /MYWHATEVER/MYTABLE')
gives me "Error 7321 while preparing query...". Using
SELECT * FROM LinkedServer..Schema.[/MYWHATEVER/MYTABLE]
yields "Error 7306 OLEDB-Provider "MSDASQL" can't open table "Schema./MYWHATEVER/MYTABLE" for linked server LinkedServer, it contains errors or doesn't exist".
Is there any way I can access tables containing / on a MaxDB via LinkedServer?
[The error messages may not be literally the same as on an english system, since I had to translate them from german]
"works for one of the two cases, see my comment on gbn's answer. – takrl Nov 9 '11 at 13:50