Posted by Dan Guzman on 07/30/06 13:44
If you have duplicate column names in an ADO recordset, you can use ordinal
position so that the reference is unambiguous:
RECORDSET(0)
RECORDSET(1)
However, it's better to specify a column alias so that all column names in
the result are unique:
SELECT
t1.MyColumn AS Table1_MyColumn,
t2.MyColumn AS Table2_MyColumn
FROM dbo.MyTable1 AS t1
JOIN dbo.MyTable2 AS t2 ON
t2.MyColumn = t1.MyColumn
RECORDSET("Table1_MyColumn")
RECORDSET("Table2_MyColumn")
--
Hope this helps.
Dan Guzman
SQL Server MVP
<mail@jazzis.com> wrote in message
news:1154265500.655946.116740@p79g2000cwp.googlegroups.com...
> Urgent help needed!
>
> I moved an application from ASP+ACCESS to ASP+MS SQLSERVER and I have
> the following problem:
>
> If the join on two tables results on duplicate colum names (which
> appear in both tables) I could reference them by using:
>
> RECORDSET("TABLENAME.COLUMNAME")
>
> However with SQLServer if I try this kind of reference I get an error
> message.
>
> How can between two colums with the same name from two differen tables?
>
> Thanks in advance!
>
> Adam
>
[Back to original message]
|