Hi,
In my below sp after executing it..as EXEC sp_SplitVal
ALTER PROC sp_SplitVal
AS
DECLARE @Test VARCHAR(1000), @RecSet VARCHAR(500)
DECLARE @StartingPos INT,@RecPos INT
DECLARE @temptable TABLE(COMPLEXIONID INT)
SET @StartingPos= 1
SET @TEST='1,3,4,'
--SET @Test =(select cmp.complexion1 from customerexpectation cmp where cmp.customerid='4fe6559c-bc93-4d9c-bcb2-013fede7d969')
WHILE @StartingPos<=LEN(@Test)
BEGIN
SELECT @RecPos = CHARINDEX(',',@Test,@StartingPos)
SET @RecSet=SUBSTRING(@Test,@StartingPos,@RecPos-@StartingPos)
PRINT @RecSet
BEGIN
INSERT INTO @temptable VALUES(@RecSet)
SELECT * FROM @temptable
SELECT @StartingPos=@RecPos+1
END
END
i am getting the results in a loop for three times..as COMPLEXIONID
1
COMPLEXIONID
1
3
COMPLEXIONID
1
3
4 but i need it as in a single recordset.. COMPLEXIONID
1
3
4 i dont want in a loop...how to achieve this...
Join Hands Change lives
Thanks & Regards
Straight Edge Society