Closed
Description
Context is here Link to code that can be reproduced
Using UUID version 7:
var values = Enumerable.Range(1, 10)
.Select(i => {
Thread.Sleep(TimeSpan.FromMilliseconds(10)); // UUIDNext uses millisecond-precision, let's sleep for a bit
return $"({i}, '{Uuid.NewDatabaseFriendly():D}')";
})
.ToList();
Console.WriteLine($"{string.Join(", ", values)}");
Then check that ORDER BY sorts them as expected:
CREATE TABLE #testing_uuids (
ExpectedPosition int PRIMARY KEY,
UUID uniqueidentifier NOT NULL
);
INSERT INTO #testing_uuids
VALUES (1, '01855978-effc-758f-8fc1-6b755429799c'),
(2, '01855978-f00f-74c2-a6f0-8e8c5445ec9a'),
(3, '01855978-f019-7104-bab4-79f068bc8150');
SELECT *
FROM #testing_uuids
ORDER BY UUID ASC;
Unfortunately, on MSSQL I got 1, 3, 2.
Metadata
Metadata
Assignees
Labels
No labels