Solved

InterSystems Caché OPEN QUERY

Posted on 2015-01-23
4
444 Views
Last Modified: 2015-01-29
Hello.

I am trying to use an open query on InterSystems Caché through a linked server.


SELECT  *

FROM OPENQUERY([LinkedServer], 'SELECT * from Table')

error

OLE DB provider "MSDASQL" for linked server "INQUIRE" returned message "[Cache ODBC][State : 37000][Native Code 1]
[C:\Program Files\Microsoft SQL Server\MSSQL11.BISQL02\MSSQL\Binn\sqlservr.exe]
[SQLCODE: <-1>:<Invalid SQL statement>]
[Cache Error: <<SYNTAX>errdone+2^%qaqqt>]
[Details: <Prepare>]
[%msg: < SQL ERROR #1: IDENTIFIER expected, [ found^SELECT [ AccidentCode ] from [>]".
Msg 7321, Level 16, State 2, Line 4
An error occurred while preparing the query "SELECT [AccidentCode] from [ADMITDISCH]" for execution against OLE DB provider "MSDASQL" for linked server "INQUIRE".
0
Comment
Question by:aneilg
  • 2
  • 2
4 Comments
 
LVL 18

Expert Comment

by:Simon
ID: 40566155
1. You need to include the schema name as well as the table.

Here's an example of a working query:
select * from openquery(kbsql_XXXX,'Select count(*) from R.MEDRECS_HISTORY')

Open in new window


Which version of the ODBC driver to you have and is it 32bit or 64bit?
0
 

Accepted Solution

by:
aneilg earned 0 total points
ID: 40566236
Thanks.

Does not seem to like *, you not to select individual tables.
0
 

Author Comment

by:aneilg
ID: 40566242
I've requested that this question be closed as follows:

Accepted answer: 0 points for aneilg's comment http:#a40566236

for the following reason:

partly answered.
0
 
LVL 18

Expert Comment

by:Simon
ID: 40566243
hi aneilg, sorry I didn't quite understand your last comment or close request reason...

select * from openquery(kbsql_XXX,'Select * from r.tablename')

...does work (provided that the meta-data is correct in the data dictionary for that table).
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now