Skip to content

Instantly share code, notes, and snippets.

@fschmied fschmied/GetFrom.sql
Created Mar 28, 2016

Embed
What would you like to do?
NEventStore's MsSql GetFrom (checkpoint) query
WITH [cte] AS
( SELECT BucketId, StreamId, StreamIdOriginal, StreamRevision, CommitId, CommitSequence, CommitStamp, CheckpointNumber, Headers, Payload
, ROW_NUMBER() OVER (ORDER BY CheckpointNumber) AS [row] FROM Commits WITH (READCOMMITTEDLOCK)
WHERE CheckpointNumber > @CheckpointNumber
)
SELECT *
FROM [cte]
WHERE [row] BETWEEN @Skip + 1
AND @Limit + @Skip;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.