|
|
posted on February 01, 2021 15:20
CREATE FUNCTION GIBS_GetProfileElement
(
@userID as int,
@portalID as int,
@ProfilePropertyName as nvarchar(100)
)
RETURNS nvarchar(4000) AS
BEGIN
-- If input is invalid, return null.
IF @ProfilePropertyName IS NULL
OR LEN(@ProfilePropertyName) = 0
OR @userID IS NULL
OR @userID < 1
RETURN NULL
DECLARE @PropertyValue AS NVARCHAR(400)
SET @PropertyValue =
(
SELECT UserProfile.PropertyValue
FROM (Users INNER JOIN UserProfile ON Users.UserID = UserProfile.UserID) INNER JOIN ProfilePropertyDefinition ON UserProfile.PropertyDefinitionID = ProfilePropertyDefinition.PropertyDefinitionID
WHERE (((Users.UserID)=@userID) AND ((ProfilePropertyDefinition.PropertyName)=@ProfilePropertyName) AND ProfilePropertyDefinition.PortalID = @portalID)
)
RETURN @PropertyValue
END
There are currently no comments, be the first to post one!