1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 05:00:19 -05:00
bitwarden/util/Migrator/DbScripts/2024-09-11_02_UserTransactionsReadCursor.sql

19 lines
390 B
Transact-SQL

CREATE OR ALTER PROCEDURE [dbo].[Transaction_ReadByUserId]
@UserId UNIQUEIDENTIFIER,
@Limit INT,
@StartAfter DATETIME2 = NULL
AS
BEGIN
SET NOCOUNT ON
SELECT
TOP (@Limit) *
FROM
[dbo].[TransactionView]
WHERE
[UserId] = @UserId
AND (@StartAfter IS NULL OR [CreationDate] < @StartAfter)
ORDER BY
[CreationDate] DESC
END