Relative Content

Tag Archive for sequencewindow-functionssql-server-2016

Creating Sequence numbers with hourly reset

I am attempting to create a sequence number that is unique to the account and resets after an hour of no activity. Below I have code that generates sample data and desired output. I have tried doing lag, lead, row_number, combing date and time columns into datetime field to use in those functions but I have not gotten it to work.