Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>please Check this Sample SP</p> <p>you need to create XML for each row same like below format and give to SQL..</p> <p>Some modification as per your requirement may be solve your problem..</p> <pre><code>/************************************************************** EXEC wa_TempInsert '&lt;SampleXML&gt; &lt;tblRow&gt;&lt;Id&gt;3&lt;/Id&gt;&lt;Code&gt;11&lt;/Code&gt;&lt;Description&gt;Leptospiral infect NEC&lt;/Description&gt;&lt;/tblRow&gt; &lt;tblRow&gt;&lt;Id&gt;3&lt;/Id&gt;&lt;Code&gt;22&lt;/Code&gt;&lt;Description&gt;Leptospiral infect NEC&lt;/Description&gt;&lt;/tblRow&gt; &lt;tblRow&gt;&lt;Id&gt;3&lt;/Id&gt;&lt;Code&gt;33&lt;/Code&gt;&lt;Description&gt;Leptospiral infect NEC&lt;/Description&gt;&lt;/tblRow&gt; &lt;tblRow&gt;&lt;Id&gt;3&lt;/Id&gt;&lt;Code&gt;44&lt;/Code&gt;&lt;Description&gt;Leptospiral infect NEC&lt;/Description&gt;&lt;/tblRow&gt; &lt;tblRow&gt;&lt;Id&gt;3&lt;/Id&gt;&lt;Code&gt;55&lt;/Code&gt;&lt;Description&gt;Leptospiral infect NEC&lt;/Description&gt;&lt;/tblRow&gt; &lt;/SampleXML&gt;' */ CREATE PROCEDURE wa_TempInsert ( @XML NVARCHAR(MAX) ) AS SET NOCOUNT ON BEGIN DECLARE @Id INT DECLARE @MyXML XML SET @MyXML = @XML IF OBJECT_ID('tempdb..#TempXMLTable') IS NOT NULL DROP TABLE #TempICD SELECT * INTO #TempICD FROM ( SELECT Parse.value('(Id)[1]', 'INT') AS 'Id', Parse.value('(Code)[1]', 'Varchar(100)') AS 'Code', Parse.value('(Description)[1]', 'varchar(1000)') AS 'Description' FROM @MyXML.nodes('/SampleXML/tblRow') AS TempData(Parse) ) AS tbl INSERT INTO Table (Code,[Description],Id) SELECT DISTINCT Code,[Description],Id FROM #TempXMLTable END END </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload