Friday, March 30, 2012

Openquery Error

Hi I am trying to connect to teradata using SQL Query Analyzer
Teradata is linked through our Linked Server
Below is the query I run
select * from openquery(teradata, 'SELECT * FROM mktg.vtcsr');
mktg is schema is teradata database
The error it gives me is:
Server: Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing a query for execution against OLE DB
provider 'MSDASQL'.
OLE DB error trace [OLE/DB Provider 'MSDASQL' ICommandPrepare::Prepare
returned 0x80040e14].
Did you try the exact command on your terradata ? Are you sure that you
are connected to the right entity (database etc, don=B4t know the
details of that one) ?
HTH; Jens Suessmeyer.
|||Jens wrote:
> Did you try the exact command on your terradata ? Are you sure that you
> are connected to the right entity (database etc, don=B4t know the
> details of that one) ?
> HTH; Jens Suessmeyer.
I can access the same teradata database using Queryman and also using
SAS no problems. I have access to three databases in Teradata and out
of three i can acess one easily using Query Analyzer but other two it
gives me error as described above.
Since I can connect to teradata through Queryman and SAS that means my
ODBC drivers and access to these database both are fine. But I am
failing to understand why Openquery is failing.
|||pradeep_raina@.hotmail.com (pradeep_raina@.hotmail.com) writes:
> Hi I am trying to connect to teradata using SQL Query Analyzer
> Teradata is linked through our Linked Server
> Below is the query I run
> select * from openquery(teradata, 'SELECT * FROM mktg.vtcsr');
> mktg is schema is teradata database
> The error it gives me is:
> Server: Msg 7321, Level 16, State 2, Line 1
> An error occurred while preparing a query for execution against OLE DB
> provider 'MSDASQL'.
> OLE DB error trace [OLE/DB Provider 'MSDASQL' ICommandPrepare::Prepare
> returned 0x80040e14].
The errors from queries to linked servers are often very difficult to
understand. Error 0x80040e14 is DB_E_ERRORSINCOMMAND, and the explanation
I find in the description for ICommandPrepare::Prepare is "The command text
contained one or more errors. Providers should use OLE DB error objects to
return details about the errors."
My interpretation is that the command fails for some reason.
Now, I don't know Teradata at all, but it looks a little funny
when you say that mktg is your schema, and then you say that you
have access to three databases on Teradata. Shouldn't you specify
the database as well? My guess is that your command fails, because
Teradata cannot find mktg.vtcsr in the database where it is looking.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

No comments:

Post a Comment