Link to home
Start Free TrialLog in
Avatar of JC_Lives
JC_LivesFlag for United States of America

asked on

SQL Server can't run query directly, only using openquery()

Hi experts,

I can't seem to run this query directly:

select acct#, CLSDCD, LKOTCD, LNTYPE, COUNCD, WARNCD From HALS.HALS.MTGLIBP1.CHMSTRAA# where acct# in (
                  74270449, 64709121)

because I get this message: Msg 7340, Level 16, State 4, Line 1
Cannot create a column accessor for OLE DB provider "IBMDASQL" for linked server "HALS".

But I can run it through an openquery statement:

select acct#, CLSDCD, LKOTCD, LNTYPE, COUNCD, WARNCD from openquery(HALS, 'select acct#, CLSDCD, LKOTCD, LNTYPE, COUNCD, WARNCD From HALS.MTGLIBP1.CHMSTRAA# where acct# in (74270449, 64709121)')

My problem is, the source table is so huge that I can't really join on it. I need to pass in a long list of acct#s (like I'm doing, just a lot longer). But the string size limit inside the open query statement is 8,000 characters. Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JC_Lives

ASKER

That is not what I wanted to hear! hehe ok thanks for your time :)