Initial
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
USE [DD_ECM]
|
||||
GO
|
||||
|
||||
/****** Object: UserDefinedFunction [dbo].[FNCUST_SPLIT_STRING_WITH_GUID] Script Date: 21.03.2024 17:37:36 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
|
||||
|
||||
-- Stand: MK // 28.01.2021
|
||||
-- Verwendet in Schleupen Schnittstelle und PM Monitoring
|
||||
|
||||
CREATE FUNCTION [dbo].[FNCUST_SPLIT_STRING_WITH_GUID] (
|
||||
@Input NVARCHAR(MAX),
|
||||
@Character CHAR(1)
|
||||
)
|
||||
RETURNS @Output TABLE (GUID INTEGER IDENTITY(1,1), Item NVARCHAR(1000))
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @StartIndex INT, @EndIndex INT
|
||||
|
||||
SET @StartIndex = 1
|
||||
IF SUBSTRING(@Input, LEN(@Input) - 1, LEN(@Input)) <> @Character
|
||||
BEGIN
|
||||
SET @Input = @Input + @Character
|
||||
END
|
||||
|
||||
WHILE CHARINDEX(@Character, @Input) > 0
|
||||
BEGIN
|
||||
SET @EndIndex = CHARINDEX(@Character, @Input)
|
||||
|
||||
INSERT INTO @Output(Item)
|
||||
SELECT SUBSTRING(@Input, @StartIndex, @EndIndex - 1)
|
||||
|
||||
SET @Input = SUBSTRING(@Input, @EndIndex + 1, LEN(@Input))
|
||||
END
|
||||
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
|
||||
|
||||
Reference in New Issue
Block a user