While I am working with the java team, they asked me to insert a batch of queries through procedure ; ie the input is in the form of string as below,
So splitting each column values and inserting into the table is the first idea that came to my mind.After doing with string functions ,I become irritated.So I thought of execute a string .
CREATE PROC New_proc
DECLARE @id VARCHAR(MAX)
DECLARE @str1 NVARCHAR(MAX)
SET @id = ( ‘(”va”,1,2),(”vb”,2,1)’ )
SET @str1 = (SELECT ‘insert into parents values’ + ‘ ’ + @id)
EXECUTE Sp_executesql @str1;