Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

SQL 2008 R2 / SQL 2014 Sort Order

$
0
0
Folks:We recently upgraded our SQL server from 2008 R2 to SQL 2014 and I see a difference in how the sort is handled in 2014. We have a table 'tblemp' with index on SDate (Date column). [code="sql"]create table tblemp(empid int,empname varchar(10),SDate datetime)insert into tblemp values (1,'Paul','05/04/2014')insert into tblemp values (2,'John','06/05/2014')insert into tblemp values (3,'Chris','04/15/2014')insert into tblemp values (4,'James','03/20/2014')insert into tblemp values (5,'David','02/17/2014')create clustered index idxtmpemp on tblemp(SDate)[/code]In SQL 2008 R2 when we executed the below query we got the output in DESCENDING order of SDate (Date) based on the order by to the insert into @tblOutput, but in SQL 2014 we are getting the output in ASCENDING order. Any Idea what might be the problem? [code="sql"]DECLARE @tblOutput TABLE(empid int,ename varchar(10),AsOfDate datetime)insert into @tblOutput select * from tblemporder by SDate desc ------ DESCENDINGselect * from @tblOutput[/code]Thanks !

Viewing all articles
Browse latest Browse all 6525

Trending Articles