Skip to content

Instantly share code, notes, and snippets.

@fschmied
Created March 28, 2016 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fschmied/47f716c32cb64b852f90 to your computer and use it in GitHub Desktop.
Save fschmied/47f716c32cb64b852f90 to your computer and use it in GitHub Desktop.
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