Stored Procedures [dbo].[XLedgerGetConfigSyncRequestInfo]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
CREATE PROCEDURE [dbo].[XLedgerGetConfigSyncRequestInfo]
AS
begin
    set nocount on

    declare @ids IntList

    --find the items that we want to work with
    insert into @ids(Item)
        select XLedgerOnDemandSyncHistory.XLedgerOnDemandSyncHistoryId
        from XLedgerOnDemandSyncHistory
        where XLedgerOnDemandSyncHistory.StartedAt is null

    declare @now datetimeoffset = sysdatetimeoffset()

    --mark them as started
    update XLedgerOnDemandSyncHistory set StartedAt = @now
    from @ids Ids
    inner join XLedgerOnDemandSyncHistory on
        Ids.Item = XLedgerOnDemandSyncHistory.XLedgerOnDemandSyncHistoryId

    --return their info
    select
        Id = XLedgerOnDemandSyncHistory.XLedgerOnDemandSyncHistoryId,
        SyncType = XLedgerOnDemandSyncType.Description
        from @ids Ids
        inner join XLedgerOnDemandSyncHistory on
            Ids.Item = XLedgerOnDemandSyncHistory.XLedgerOnDemandSyncHistoryId
        inner join XLedgerOnDemandSyncType on XLedgerOnDemandSyncHistory.XLedgerOnDemandSyncTypeFid = XLedgerOnDemandSyncType.XLedgerOnDemandSyncTypeId
end
GO
GRANT EXECUTE ON  [dbo].[XLedgerGetConfigSyncRequestInfo] TO [MssExec]
GO
Uses