0

want create store procedure of these tables for my xml file as i given up

select * from pro.Proposals
select * from dbo.[pro.ProposalDetails
select * from dbo.[pro.ProposalSlabs]

enter image description here

i want many-to-many save data in table through xml file in stored procedure using sql server*, i send you my xml file with created stored procedure. XML FILE

ML FILE

<root> <subCompanyId>1</subCompanyId> <code>sdfgsdgsdfgsdfg</code> <countryId>1</countryId> <groupId>1</groupId> <branchId>1</branchId> <isBranchProposal>1</isBranchProposal> <countryRateListId>1</countryRateListId> <yearsNo>1</yearsNo> <subTotal>1.0</subTotal> <total>1.0</total> <companyId>1</companyId> <createdBy>AF@fdfsae</createdBy> <userAttemptNo>1</userAttemptNo> <isApproved>1</isApproved> <details> 
Thom A
  • 88,727
  • 11
  • 45
  • 75
  • You can [edit](https://stackoverflow.com/posts/52665468/edit) your question. Don't post important information in the comments. i've added the data into the question, however, since it was a comment it has lost any formatting. i would suggest updating it to be readable. – Thom A Oct 05 '18 at 12:21
  • 1
    Edit your question... Stop spamming the comments, please. – Thom A Oct 05 '18 at 12:49
  • 1
    This stream of comments come across as general plea to do your job for you. This is not a free code writing service that exists to provide instant help when you are in over your head. Don't post pictures of tables. Why? https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question/285557#285557 I sense you are desperate for help but this question is not answerable at this point because it lacks the details. [Here](http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/) is a great place to start. – Sean Lange Oct 05 '18 at 13:36
  • *"I complete send my work plz anyone help me it's must for my career Thanks"* This isn't going to help you get answers from the community. The last thing you should be doing to relying on a (somewhat) anonymous community to help you keep your job. I'm afraid what you are asking is still completely unclear. You XML is unformatted, and unreadable as a result. When posting on Stack Overflow, the **volunteers** expect some due diligence. Explain what you're trying to do, provide sample data (not as a an image), show what you've tried, and **importantly**, ask a **specific** question. – Thom A Oct 05 '18 at 13:37

1 Answers1

0

Resolving a many to many relationship is done in SQL via resolving it into 2 one to many relationships and establishing an intermediary "bridge". Example: students and classes. multiple students have multiple classes. You establish one student table and one class table and the intermediary table is the "enrollment" table. This has been addressed in SOF already here and here

benji2505
  • 106
  • 1
  • 5
  • How is this related to the question? – Ivan Starostin Oct 05 '18 at 14:18
  • I think OP is asking how to store a many to many data relationship in a normalized SQL DB. – benji2505 Oct 05 '18 at 14:40
  • Looks like he already has all the tables created and wants to populate/update them with data from given XML file. – Ivan Starostin Oct 05 '18 at 14:51
  • correct, I would think that the xml file delivers data junk, one problem being many to many relationships. It is also a miracle to me why OP wants to create a "procedure" on the SQL server side rather than solving this in Java, tbh. – benji2505 Oct 05 '18 at 16:43