Hi,,
I need to pass the splitted string as a parameter in SQL Stored Procedure please find the exact solu....Below i've my Sp please guide me to achieve my solution...
Hi in my table i have an column called complexion where i've the data as 2,5, i am getting two and 5 seperately i need to pass thw value of 2 nad 5 and i should get the two rows in my dataset...but i am getting two rows with both values as 2,5, only not as 2 & 5 seperately
[CODE]
DECLARE @Test VARCHAR(1000), @RecSet VARCHAR(500), @ID VARCHAR(10), @Value VARCHAR(60)
DECLARE @StartingPos INT,@RecPos INT
SET @StartingPos= 1
SET @Test =(select cmp.complexion1 from customerexpectation cmp where cmp.customerid='68572b93-16bd-4764-b75f-3aad35fef04b')
WHILE @StartingPos<=LEN(@Test)
BEGIN
SELECT @RecPos = CHARINDEX(',',@Test,@StartingPos)
SELECT @RecSet=SUBSTRING(@Test,@StartingPos,@RecPos-@StartingPos)
PRINT @RecSet
SELECT CC.CUSTOMERID,CC.COMPLEXION1,CM.ID FROM CUSTOMEREXPECTATION CC
LEFT OUTER JOIN
COMPLEXION CM
ON CC.COMPLEXION1=@RecSet WHERE CUSTOMERID='68572b93-16bd-4764-b75f-3aad35fef04b'
SELECT @StartingPos=@RecPos+1
END[/CODE]