Re: Help with openquery
From: Chris (Chris_at_discussions.microsoft.com)
Date: 10/13/04
- Next message: Stephen Ahn: "Line numbers reported by tools on errors"
- Previous message: Joe Celko: "Re: How to specify column header titles in a SQL CREATE TABLE statement?"
- In reply to: Steve Kass: "Re: Help with openquery"
- Next in thread: Steve Kass: "Re: Help with openquery"
- Reply: Steve Kass: "Re: Help with openquery"
- Messages sorted by: [ date ] [ thread ]
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?
> >
> >
> >
>
- Next message: Stephen Ahn: "Line numbers reported by tools on errors"
- Previous message: Joe Celko: "Re: How to specify column header titles in a SQL CREATE TABLE statement?"
- In reply to: Steve Kass: "Re: Help with openquery"
- Next in thread: Steve Kass: "Re: Help with openquery"
- Reply: Steve Kass: "Re: Help with openquery"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|