I pass one line to store the procedure: 1:20,2:30,4:50 It contains id and the corresponding value for it.
how can i add a value as shown in the table below in the database.
ID Value 1 20 2 30 4 50
I already have a function "stringSplit", which works fine and produces a value in a string. Some people think so:
1:20 2:30 4:50
Can someone help me insert data into a table with any solution.
I'm already trying this solution
insert <table> (colname) select y.item from dbo.SplitString(@testString, ':') x cross apply dbo.SplitString(x.item, ',') y
but this will return a duplicate value as the id value.
my store procedure
CREATE PROCEDURE [dbo].[temp_result_insert] @dataString varchar(max) AS insert into tempTable(id,marks) select x.Item,y.Item from dbo.SplitStringVarcahr(@dataString, ':') x cross apply dbo.SplitStringVarcahr(x.Item,',') y RETURN 0
source share