Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Different sort order when select in nolock

Author  Topic 

jimmy2090
Starting Member

26 Posts

Posted - 2015-02-26 : 00:39:21
Hi all,

i have sql script select with nolock and without nolock, the data in different sort order.
anyone have any idea?

only different in certain data.

		SELECT D.ID, D.Program
FROM RadarDetail D (NOLOCK)
WHERE D.masterid = '125'

SELECT D.ID, D.Program
FROM RadarDetail D
WHERE D.masterid = '125'


the order is different when the id is ='125'
but other id, the order is same.

stepson
Aged Yak Warrior

545 Posts

Posted - 2015-02-26 : 01:17:38
If you don't have an ORDER BY , then the output is not guaranteed.

quote:
The order in which rows are returned in a result set are not guaranteed unless an ORDER BY clause is specified.

https://msdn.microsoft.com/en-us/library/ms188385.aspx?f=255&MSPPError=-2147217396


sabinWeb MCP
Go to Top of Page
   

- Advertisement -