See the Code Below:
DECLARE @NodesList varchar(4000)
DECLARE @NodeName varchar(10)
Declare @Pos int
SET @NodesList = @Replace_This_With_Your_Pa
SET @Pos = CHARINDEX(',', @NodesList, 1)
BEGIN
WHILE @Pos > 0
BEGIN
SET @NodeName = LTRIM(RTRIM(LEFT(@NodesLis
IF @NodesList <> ''
BEGIN
--the below statement will display the values one by one , you can manipulate the value here however you want
SELECT @Line_Id, @NodeName
END
SET @NodesList = RIGHT(@NodesList, LEN(@NodesList) - @Pos)
SET @Pos = CHARINDEX(',', @NodesList, 1)
END
Basically @Pos is the position of the next comma, and it will keep looping through them one by one until the end.
Main Topics
Browse All Topics





by: sdstuberPosted on 2008-08-07 at 06:23:01ID: 22180631
First, create the type and function below, then try this...
ode_name, ','))
SELECT line_id, COLUMN_VALUE node_name
FROM your_table, table(str2tbl(your_table.n
Select allOpen in new window