• Login

Snippets

01
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

Post Rating

Comments

There are currently no comments, be the first to post one!

Post Comment

Name (required)

Email (required)

Website