I have two tables, T_A (main source) And T_B where i want to insert data from t_A, but i don't want to use while loop or cursors.
Following File is for T_A & T_B, (I already inserted data in T_B, but in reality its empty)
Answer by Kev Riley ·
You are nearly there with your query, you'd just need to build up the full path. You can achieve that by using a recursive CTE to walk through the XML structure.
Or do what I always do, and use the useful XMLTable function by Jacob Sebastian (https://gist.github.com/jacobvettickal/601c197d716d0aeb40c1c177ca1503d8)
Add this function to your database and then query it using
select xt.ID ,xt.Name ,xt.VERSION ,xt.checkup ,x.FullPath ,x.Value from dbo.T_A xt cross apply dbo.XMLTable(xt.XMLPath) x where xt.checkup =0
You might need to manipulate the output a little if you want the leading forward slash, and/or remove @ symbols from attributes, but it should get you further