Re: Help with openquery

From: Chris (Chris_at_discussions.microsoft.com)
Date: 10/13/04


Date: Tue, 12 Oct 2004 17:23:03 -0700

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?
> >
> >
> >
>



Relevant Pages

  • RE: QUERY DESIGN HELP
    ... which custId, productName, categoryName the customer wants to be listed under. ... At the moment I have a query that pulls all this info together. ...
    (microsoft.public.access.queries)
  • Re: Help wiht database design
    ... which custId, productName, categoryName the customer wants to be listed under. ... At the moment I have a query that pulls all this info together. ...
    (microsoft.public.access.tablesdbdesign)
  • RE: QUERY DESIGN HELP
    ... which custId, productName, categoryName the customer wants to be listed under. ... At the moment I have a query that pulls all this info together. ...
    (microsoft.public.access.queries)
  • RE: DATABASE DESIGN HELP
    ... More than one customer can select the same combination. ... which custId, productName, categoryName the customer wants to be listed under. ... At the moment I have a query that pulls all this info together. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: MailMerge hangs and crashes with Access on Server
    ... Since I am fairly new to working in this environment, I am not sure what you mean by an "Access group" with help to restructuring the query? ... "Peter Jamieson" wrote: ... All I know is that the performance of queries depends to a large extent on whether, for example, a join is performed on the client side, or on the server side, incurring no network traffic and potentially benefitting from caching on the server. ... There are no dialog boxes, and actually, I have now split the database, and have kept the Word templates and the Access frontend locally on my machine, and moved the backend to the server. ...
    (microsoft.public.word.mailmerge.fields)