You are here: Re: Referencing colum names in recordset which is created by join - URGENT! « MsSQL Server « IT news, forums, messages
Re: Referencing colum names in recordset which is created by join - URGENT!

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
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация