[dbo].[EmailApiGetOutgoingEmailDocumentAttachments]
CREATE PROCEDURE [dbo].[EmailApiGetOutgoingEmailDocumentAttachments]
@inOutgoingEmailIds IntList readonly
AS
begin
set nocount on
select
OutgoingEmailId = OutgoingEmailDocumentAttachment.OutgoingEmailFID,
[FileName] = MssDocumentImage.DocumentName,
AttachmentPosition = OutgoingEmailDocumentAttachment.AttachmentOrder,
MssDocumentId = OutgoingEmailDocumentAttachment.MssDocumentFID
from @inOutgoingEmailIds inOutgoingEmailIds
inner join OutgoingEmailDocumentAttachment on
inOutgoingEmailIds.Item = OutgoingEmailDocumentAttachment.OutgoingEmailFID
inner join MssDocument on OutgoingEmailDocumentAttachment.MssDocumentFID = MssDocument.MSSDocumentID
inner join MssDocumentImage on MssDocument.MSSDocumentImageFID = MssDocumentImage.MSSDocumentImageID
end
GO
GRANT EXECUTE ON [dbo].[EmailApiGetOutgoingEmailDocumentAttachments] TO [MssExec]
GO