There are instances when we want to insert a record into a table and based on the identity value of that row insert remaining content into another table. For the purpose of better understanding let me explain the case with an example. Assume from a front-end page a user would provide a student's "Name", "Age' and "List of subjects he/she would be learning". Once the user clicks on "Save" button "Student Name and Age" needs to be stored in Table1 and with its identity value insert subject list in Table2. Hope I have made the case clear :) There are actually two methods to approach this situation. They are: 1. Making use of sp_xml_preparedocument, sp_xml_removedocument and 2. Custom split function Well, now let us take these items one by one and see how to solve this problem. Sample table structure Both the methods explained in this post would use the below table structure only. Create table StudentMaster ( StudentID int Identity(1,1
I write about things which I am passionate about.