SELECT * INTO retains ORDER BY in SQL Server 2008 but not 2012

后端 未结 6 1242
星月不相逢
星月不相逢 2021-01-04 18:34

Execute the following SQL in 2008 and 2012. When executed in 2008, the returned result is in its correct sort order. In 2012, the sortorder is not retained.

Is this

6条回答
  •  猫巷女王i
    2021-01-04 18:41

    If you have different sorted results when querying each database, your collation is probably different between the two.

    Try explicitly setting the collation in your query and see if your results are returned in the same order in both databases, e.g.

    SELECT * FROM #Result ORDER BY C1 COLLATE Latin1_General_CS_AS
    

提交回复
热议问题