Did the ordering of the returned columns change for select * for SQL Server 2012?
For example, for a table t with the columns a1,a2,a3 for which select * from t returned the columns in the order a1,a2,a3 for SQL Server versions prior to 2012, and after migrating to 2012 the order changed to some other order, e.g., a3,a1,a2.
Did anyone else notice this?
Why did this change?
I am personally curious as to why this happened. Maybe some problem with the conversion to SS 2012?
(No, my application does not depend on the column ordering and I know I should specify the columns I need in the order I want them instead of using select *)
It depends on each column’s
ordinal_positionvalue in theinformation_schema.columnstable.Each column has an entry in this table with the table name and the ordinal position. Try this:
this should return the same as in the previous instance.