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?
views:
82answers:
1
+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
2009-05-01 15:33:38