[dbo].[MssWebGetAccountProfileDocuments]
CREATE PROCEDURE [dbo].[MssWebGetAccountProfileDocuments]
@accountProfileID INT
AS
SELECT
AccountProfileDocumentId = AccountProfileDocument.AccountProfileDocumentID,
AccountProfileDocument.DocumentName,
AccountProfileDocument.DocumentDescription,
DocumentGroup = AccountProfileDocumentGroup.[Description],
DocumentType = AccountProfileDocumentType.[Description],
AttachedBy = dbo.FormatFirstNameLastName( AttachedBy.FIRSTNAME, AttachedBy.LASTNAME ),
AccountProfileDocument.AttachedOn,
AccountProfileDocument.LastModified
FROM AccountProfileDocument
INNER JOIN AccountProfileDocumentType ON
AccountProfileDocument.AccountProfileDocumentTypeFID = AccountProfileDocumentType.AccountProfileDocumentTypeID
INNER JOIN AccountProfileDocumentGroup ON
AccountProfileDocumentType.AccountProfileDocumentGroupFID = AccountProfileDocumentGroup.AccountProfileDocumentGroupID
INNER JOIN SysUser AttachedBy ON
AccountProfileDocument.AttachedByFID = AttachedBy.SysUserID
WHERE
AccountProfileDocument.AccountProfileFID = @accountProfileID AND
AccountProfileDocument.Inactive = 0
ORDER BY
AccountProfileDocumentGroup.SortBy ASC,
AccountProfileDocument.DocumentName ASC
GO
GRANT EXECUTE ON [dbo].[MssWebGetAccountProfileDocuments] TO [MssExec]
GO