Can anyone explain in simple words what does this warning mean?
I have a complicated query in Access that works fine and returns the expected results.
If I copy its sql to a view in SSMS, I receive the above message when I try to save the view.
Clicking OK bypasses the warning and the view saves. The result is correct, but it's not ordered based on Delivery field.
Here's a simplified version of the sql (which still returns the same error)
From Warning:
"The ORDER BY clause does not guarantee ordered results when the view is queried, Unless ORDER BY is also specified in the query itself"
If I understand the error correctly, Delivery is already included in SELECT.
Note 1: The first TOP (100) PERCENT is added by SSMS
Note 2: If I ran the same sql in a query window in SSMS, The warning doesn't appear, the result is correct and in order.
Thanks
I have a complicated query in Access that works fine and returns the expected results.
If I copy its sql to a view in SSMS, I receive the above message when I try to save the view.
Clicking OK bypasses the warning and the view saves. The result is correct, but it's not ordered based on Delivery field.
Here's a simplified version of the sql (which still returns the same error)
SQL:
SELECT TOP (100) PERCENT
o.Rec,
p.DrawingNo,
p.DrawingName,
o.Delivery,
o.SetName,
o.OrderPK
FROM dbo.tblOrdersPr AS op
INNER JOIN dbo.tblOrders AS o
ON op.OrderFK = o.OrderPK
INNER JOIN dbo.tblProducts AS p
ON o.OrderProductFK = p.ProductPK
WHERE (o.Delivery > '2024/03/14 12:00:00')
AND (o.SetName IS NULL)
AND (o.Deleted = 0)
ORDER BY o.Delivery
From Warning:
"The ORDER BY clause does not guarantee ordered results when the view is queried, Unless ORDER BY is also specified in the query itself"
If I understand the error correctly, Delivery is already included in SELECT.
Note 1: The first TOP (100) PERCENT is added by SSMS
Note 2: If I ran the same sql in a query window in SSMS, The warning doesn't appear, the result is correct and in order.
Thanks
Last edited: