emailCampaigns log {ts '2025-05-20 12:23:36'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( 1 = 1 ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 12:23:52'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( 1 = 1 ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 12:37:08'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 12:37:08'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 12:42:14'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 12:44:35'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 12:44:35'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:21:15'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:21:15'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:22:18'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:22:18'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:23:56'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:25:00'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( 1 = 1 ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:27:13'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:28:26'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:36:37'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( 1 = 1 ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:37:24'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:37:52'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:38:11'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:39:03'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:39:20'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:39:40'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:43:31'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:43:54'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:44:01'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:47:02'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:48:14'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 17131 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:48:39'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23038 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:48:39'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( 1 = 1 ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:49:02'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:49:03'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:49:42'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:49:54'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:50:52'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:51:47'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:52:09'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:56:53'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '0' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:56:56'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:58:05'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( 1 = 1 ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 13:58:15'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '51' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:01:13'} SQL {ts '2025-05-20 14:01:13'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:04:06'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:04:19'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:04:27'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:04:31'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:04:42'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:04:55'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:09:12'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:09:21'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:10:13'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:10:47'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:10:51'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where ( [gtmCampaignId] = '52' ) ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER {ts '2025-05-20 14:11:47'} SQL declare @ownerId int = 2252 ; declare @ownerType varchar(3) = 'MFR' ; with data as ( select e.campaignId, dbo.fseToken( e.campaignId ) as campaignTk, e.name as campaignName, e.campaignType, e.emailSubject, e.emailFromDisplay, e.emailFrom, cast( case when coalesce( e.scheduled, 'N' ) = 'Y' then 1 else 0 end as bit ) scheduled, e.useInternalContact, e.runDate, e.includeUnsubscribe, e.statusCd, e.timeReminded, e.timeStarted, e.timeCompleted, e.creator_typ, e.message1Default, e.message2Default, e.lastUpdatedDate, e.createDate, e.emailManagerVersion, e.emailEditorType, e.eai_batchId, dbo.fseToken( e.eai_batchId ) as eai_batchTk, e.creator_member_id, e.targetListId, e.updateUserId, e.responderListId, e.formResponderListId, case when e.statusCd = 'PEN' then 'Pending' when e.statusCd = 'RUN' then 'Running' when e.statusCd = 'ABT' then 'Aborted' when e.statusCd = 'SUC' then 'Executed' else 'Unknown' end as status, case when e.scheduled = 'N' then 'Not Scheduled' else case when e.statusCd = 'PEN' then 'Scheduled for Future Date/Time' when e.statusCd = 'RUN' then 'Currently Running' when e.statusCd = 'ABT' then 'Executed Unsuccessfuly' when e.statusCd = 'SUC' then 'Executed Successfully' else 'Unknown' end end as statusLong, m.campaignId gtmCampaignId, m.campaignName gtmCampaignName , e.emailMessage , e.emailMessageEditorContent , ( SELECT count(*) FROM tbl_EML_CampaignRecipients r with (nolock) WHERE r.CampaignID = e.campaignId ) as recipientCount , ( select count(*) from tbl_EML_RecipientClicks rc with (nolock) inner join tbl_EML_CampaignRecipients r with (nolock) on r.RecipientID = rc.RecipientID where rc.ignoreClick = 'n' and r.campaignId = e.campaignId ) as clicks , ( select count(*) from tbl_eml_campaignunsubscribes u with (nolock) where u.campaignid = e.campaignId and u.ownerid = e.ownerId and u.ownertype = e.fsl_tablecode ) as unsubscribes , ( select count(*) from tbl_EML_CampaignRecipients cr with (nolock) where cr.campaignId = e.campaignId and cr.beaconCount >= 1 ) as opens , case when e.eai_batchId is not null then ( select b.status, b.message, b.batchTime, b.statusTime from tbl_EAI_InboundBatches b with (nolock) where b.ownerId = e.ownerId and b.ownerType = e.fsl_tablecode and b.batchId = e.eai_batchId for json auto, include_null_values, without_array_wrapper ) else cast( null as varchar ) end as batchStatus, cast( case when e.emailMessage like '%UNSUBSCRIBE-LINK-HERE%' then 1 else 0 end as bit ) containsUnsubscribe from tbl_EML_Campaign e with (nolock) left outer join tbl_GTM_Campaigns m with (nolock) on m.ownerId = e.ownerId and m.ownerType = e.fsl_tablecode and m.campaignId = e.gtmCampaignId where e.ownerId = @ownerId and e.fsl_tablecode = @ownerType and e.emailManagerVersion = '2.0' and e.emailEditorType = 'BEE' ) , data_mappedData as ( select * from data ) , data_preData as ( select * from data_mappedData with (nolock) where [campaignId] = 23037 ) , data_data as ( select * from data_preData ) , data_return as ( select * from data_data where 1 = 1 order by campaignName offset 0 rows fetch next 10000000 rows only ) , data_result as ( select ( select count(*) from data_data ) as totalCount, ( select * from data_return for json auto, include_null_values ) as data ) select * from data_result for JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER