I am using an order by on a standard Insert .. Select into query. It is listed below. When I put an order by into the select statement, it gives an error of 'Incorrect syntax near the keyword 'order'.' However, if I remove the order by it works fine. If I run the select statement by itself, it works fine. Also, eventhough the records where inserted by a previous insert trigger, they still are not defaultly in the same order. Any ideas, or is this just a SQL Server index Opps?
Actual Query
(Description:
TransactionData is the original table
ArchivedTransactionData is the triggered insert table)
(NOTE: The query is intended to be restoring data from the Archived version)
--------------------------
Expand|Select|Wrap|Line Numbers
- insert into TransactionData (BasketTag,UserTag,[Weight],crtdDateTime,Station,GroupID)
- (select BasketTag,UserTag,[Weight],crtdDateTime,Station,GroupID from ArchivedTransactionData where crtdDateTime > '12-22-2011' order by crtdDateTime)