Re: Help with openquery
From: Steve Kass (skass_at_drew.edu)
Date: 10/13/04
- Next message: da: "Re: How to View Result Data with SQL Profiler?"
- Previous message: jim: "RE: ADO, SET FMTONLY ON, and linked server"
- In reply to: Chris: "Re: Help with openquery"
- Next in thread: Joby Joy: "Re: Help with openquery"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 13 Oct 2004 01:11:03 -0400
Chris,
In that case, either find out how to write the query in Progress so
there are no duplicate column names, or create a table in SQL Server for
the results:
create table T(
ProductName ...,
CategoryName ...,
...
)
insert into T
select * from openquery(...)
select * from T
SK
Chris wrote:
>Hi,
>The problem is I am passing this query from SQL server to a progress
>database and if I use
>
>select ProductName, CategoryName
> from openquery(
> server,
> 'select prod.name as ProductName, categ.name as CategoryName ...
>
>I get the error Unable to understand after -- "DECLARE".
>
>
>
>"Steve Kass" wrote:
>
>
>
>>Chris,
>>
>> I don't see how either query works without FROM, and I don't see why
>>you are getting the particular message you are. But if you are trying
>>to distinguish the first [name] column of the OPENQUERY output from the
>>second [name] column, you will have no luck. You need to rename them
>>within the query string sent to the server.
>>
>>select ProductName, CategoryName
>>from openquery(
>> server,
>> 'select prod.name as ProductName, categ.name as CategoryName ...
>>)
>>
>>Steve Kass
>>Drew University
>>
>>Chris wrote:
>>
>>
>>
>>>Hi,
>>>I have the foll query
>>>
>>>select * from openquery(server, 'select prod.name,categ.name,price
>>>prod,categ
>>>where
>>>prod.state = 'ny'
>>>and
>>>prod.num = categ.num')
>>>
>>>This query works fine, however, if I want to give the columns names and I do
>>>
>>>
>>>select name as ProductName, name as categoryName from openquery(server,
>>>'select prod.name,categ.name,price
>>>prod,categ
>>>where
>>>prod.state = 'ny'
>>>and
>>>prod.num = categ.num')
>>>
>>>I get the foll error:
>>>
>>>Server: Msg 207, Level 16, State 3, Line 1
>>>Invalid column name 'categ'.
>>>
>>>Any ideas?
>>>
>>>
>>>
>>>
>>>
- Next message: da: "Re: How to View Result Data with SQL Profiler?"
- Previous message: jim: "RE: ADO, SET FMTONLY ON, and linked server"
- In reply to: Chris: "Re: Help with openquery"
- Next in thread: Joby Joy: "Re: Help with openquery"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|