Quantcast
Viewing all articles
Browse latest Browse all 23857

Select column by ordinal position

Is there any way to select columns by ordinal position rather than by name?

Something like

Select t.[1] as col1, t.[2] as col2

FROM table t

The question comes because of a very specific situation where I've got 2 databases that have exactly the same schema at a column/datatype level but the column names are different.   There are a few other ways to skin the cat but I'm interested if it can be done this way - without a join to syscolumns ;)


Chuck


Viewing all articles
Browse latest Browse all 23857

Trending Articles