Created
March 28, 2016 16:43
-
-
Save fschmied/47f716c32cb64b852f90 to your computer and use it in GitHub Desktop.
NEventStore's MsSql GetFrom (checkpoint) query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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