salut,
am o coloana X intr-o tabela A de tip text
inregistrarile in ea sunt de forma:
ID Continut
1 text text ;CUI text text text.....text text ;CUI text text ..... text text ;CUI ....s.a.m.d.
2 text text ;CUI text text text.....text text ;CUI text text ..... text text ;CUI ....s.a.m.d.
.......
cum pot scoate intr-o tabela tot ce este intre ;CUI pt un anume ID
multumesc
alex.
p.s. am incercat cu functia asta dar nu o pot folosi pt campul de tip text, daca ar fi fost varchar(max) ar fi fost perfect
alter
FUNCTION [dbo].[Split]
(
@SearchString
text,
@Separator
VARCHAR(200)
)
RETURNS
@strtable TABLE (strval VARCHAR(8000))
AS
BEGIN
DECLARE
@tmpStr
VARCHAR(8000),
@intSeparatorLength
INT
SET
@intSeparatorLength = LEN(@Separator)
SET
@tmpStr = @SearchString
WHILE
1=1
BEGIN
INSERT
INTO @strtable VALUES ( SUBSTRING(@tmpStr, 0 ,CHARINDEX(@Separator,@tmpStr)))
SET
@tmpStr = SUBSTRING(@tmpStr,CHARINDEX(@Separator,@tmpStr)+LEN(@Separator),8000)
IF
CHARINDEX(@Separator,@tmpStr) < 1
BREAK
END
RETURN
END
go