Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE [ArenaDB]
- GO
- /****** Object: UserDefinedFunction [dbo].[cust_CCIW_funct_profile_path] Script Date: 7/8/2019 3:00:12 PM ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE function [dbo].[cust_CCIW_funct_profile_path] (
- @ProfileID int
- )
- RETURNS varchar(2000)
- AS
- BEGIN
- DECLARE @ParentProfileID int
- DECLARE @ProfilePath varchar(2000)
- SET @ParentProfileID = @ProfileID
- SET @ProfilePath = ''
- WHILE @ParentProfileID IS NOT NULL AND @ParentProfileID <> -1
- BEGIN
- IF @ProfilePath <> '' SET @ProfilePath = ' \ ' + @ProfilePath
- SET @ProfilePath = ISNULL(
- (SELECT profile_name
- FROM core_profile
- WHERE profile_id = @ParentProfileID), '[Deleted Profile]' ) + @ProfilePath
- SET @ParentProfileID = (SELECT parent_profile_id FROM core_profile
- WHERE profile_id = @ParentProfileID)
- END
- RETURN @ProfilePath
- END
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement