Msg 4112, Level 15, State 1, Line 2
The function 'ROW_NUMBER' must have an OVER clause with ORDER BY.
websss
ASKER
Got it thanks
Scott Pletcher
Yeah, sorry, I left out the ORDER BY, which must appear, even if it's meaningless:
;WITH cte_dups AS (
SELECT *, ROW_NUMBER() OVER(PARTITION BY GPSDateTime, ReportID, DeviceID ORDER BY GPSDateTime) AS row_num
FROM Tbl_Data
)
DELETE FROM cte_dups
WHERE row_num > 1
I'm getting the errror:
Msg 4112, Level 15, State 1, Line 2
The function 'ROW_NUMBER' must have an OVER clause with ORDER BY.