[dbo].[MssWebGetAccountProfileDocumentImage]
CREATE PROCEDURE [dbo].[MssWebGetAccountProfileDocumentImage]
@accountProfileDocumentId int
AS
begin
set nocount on
declare @externalImageId int =
(
select top 1 AccountProfileDocument.ExternalImageFID
from AccountProfileDocument
where AccountProfileDocumentID = @accountProfileDocumentId
)
declare @theDocDbName sysname = dbo.GetDocDbName()
declare @theDynamicSql nvarchar(500) = N'select DocumentImage from ' + convert(nvarchar(500),@theDocDbName) + N'..DocumentImage where DocumentImageID = @inExternalDBImageID'
exec sp_executesql @theDynamicSql, N'@inExternalDBImageID int', @externalImageId
end
GO
GRANT EXECUTE ON [dbo].[MssWebGetAccountProfileDocumentImage] TO [MssExec]
GO