5 May 2016 Most DBMSes support Analytical Functions, if the data is result of a more CREATE TABLE #TestData (ID INT NOT NULL, Col1 INT NULL); .