Скачиваний:
1
Добавлен:
20.01.2023
Размер:
1.16 Кб
Скачать
-- ================================================
-- Template generated from Template Explorer using:
-- Create Scalar Function (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the function.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION Parse
(
@string varchar(500)
)
RETURNS @table TABLE (number int identity not null, substr varchar(30))
AS
BEGIN
DECLARE @Str1 nvarchar(500), @Pos int
SET @Str1 = @String

WHILE 1 > 0
BEGIN
SET @Pos = CHARINDEX(' ', @Str1)
IF @POS > 0
BEGIN
INSERT INTO @table
VALUES (SUBSTRING (@Str1, 1, @Pos))
END
ELSE
BEGIN
INSERT INTO @table VALUES (@Str1)
BREAK
END
END

RETURN
END
GO

Соседние файлы в предмете Системы и Методы Управления Базами Данных