Sunday, June 30, 2013

Why is ORDER BY allowed in TVF but not in INLINE TVF?

ORDER BY is always permitted when you insert into a table, alhough it does not mean anything unless the table has a target table has an IDENTITY column or a column with default of NEXT VALUE FOR (SQL 2012 only).


Thus, in the example you cannot trick anything. The Database Engine is free to completely ignore your ORDER BY clause.



Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se


No comments:

Post a Comment