GilaMonster (5/23/2013)
Sergiy (5/23/2013)
GilaMonster (5/23/2013)
Since that's a valid form for the select, it's also valid for the insert...select.Very arguable.
What, that it's valid? Since it passes a syntax check it's valid T-SQL, hard to argue that it's not valid (unless in SQL 2012 that aliasing form has been removed and a query using that aliasing form fails a syntax check).
I never claimed it's a good idea or that it would magically prevent column order mistake, personally I don't like that form of aliasing and never use it. All I said was that it's a valid (ie correct, parsable) form of T-SQL.
One of the aliasing form was removed from SQL 2012, the following no longer will work:
SELECT 'Custom_Col_Name' = t.Column1 FROM Table t
This one still valid:
SELECT Custom_Col_Name = t.Column1 FROM Table t