I have a string in my stored proc like \',,,sam,,bob,\' or \',,,\' from the above string I have to delete multiple commas from it, it must look like <
\',,,sam,,bob,\'
\',,,\'
try this
SELECT @Parameter AS 'BEFORE' BEGIN WHILE CHARINDEX(',,', @Parameter) > 0 BEGIN SELECT @Parameter = REPLACE(@Parameter, ',,',',') END SELECT @Parameter AS 'AFTER' END