Accessing columns using fully qualified name from a Join
From: praskam (praskam_at_discussions.microsoft.com)
Date: 08/25/04
- Next message: ?fooguy?: "Re: Problem trying to connect to SQL using MS JDBC"
- Previous message: Joe Weinstein: "Re: Problem trying to connect to SQL using MS JDBC"
- Next in thread: Joe Weinstein: "Re: Accessing columns using fully qualified name from a Join"
- Reply: Joe Weinstein: "Re: Accessing columns using fully qualified name from a Join"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 25 Aug 2004 07:07:05 -0700
1) I'm connecting to SQLServer2000 using Microsoft SQL Server 2000 Driver for
JDBC, Service Pack 2, Version 2.2.0037
2) The query I'm executing is:
select * from employees, dept, city where dept.dpid=employees.dept and " +
"employees.cityofresidence=city.cid order by dept.dpid, empid
3) city and dept tables have a field called 'name'
4) rs.getString("name") gives dept.name (city.name if city appears before
dept in the FROM clause of the query)
5) rs.getString("city.name") throws exception - 'Invalid column name'
How can I use the fully qualified column name to retrieve correct values
irrespective of the order of the appearance of the table names in the FROM
clause of the query
Note: rs.getString(int col_num) always retrieves correct values.
- Next message: ?fooguy?: "Re: Problem trying to connect to SQL using MS JDBC"
- Previous message: Joe Weinstein: "Re: Problem trying to connect to SQL using MS JDBC"
- Next in thread: Joe Weinstein: "Re: Accessing columns using fully qualified name from a Join"
- Reply: Joe Weinstein: "Re: Accessing columns using fully qualified name from a Join"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|