Try using xml methods,
DECLARE @xml XML,
@mlt_sk VARCHAR(100)='7,11,12',
@GroupName VARCHAR(10)='xyz',
@delimiter VARCHAR(10)=','
--- Converting string to XML
SET @xml = Cast(( '<X>'
+ Replace(@mlt_sk, @delimiter, '</X><X>')
+ '</X>' ) AS XML)
--SELECT @xml
DECLARE @YOUR_TABLE AS TABLE
(
VALUE VARCHAR(100)
)
--------Use nodes() method
INSERT INTO @YOUR_TABLE
SELECT N.value('.', 'varchar(10)') + '-' + @GroupName AS Value
FROM @xml.nodes('X') AS T(N)
SELECT * FROM @YOUR_TABLE
1
solved Stored procedures in SQL Server 2012 [closed]