views:

82

answers:

1

I am creating as stored procedure that brings back a bunch of data that I need from multiple tables, however the tables share some duplicate column names. It works fine in SQL but I am wondering what will happen and how I will differentiate between them once I am accessing them as DataRows from a DataSet. Anyone know?

+7  A: 

It should automatically rename them by appending a number. For example, COLUMN_NAME, COLUMN_NAME1, and COLUMN_NAME2. But, this is difficult at best to maintain, and could cause trouble later.

To avoid this, you'll probably want to specify the names yourself using column aliases (the AS keyword):

SELECT t1.myColumn AS t1_col, t2.myColumn AS t2_col
FROM t1, t2
lc