sql server - XML to SQL Tables without explicit column names -
I am trying to insert data into XML using SQL. I have explored the process of convergence in this way.
Table #testTable (name varchar (50), designation varchar (50)); Announce @ xmldata as xml set @xmldata = '& lt ;? XML version = "1.0"? & Gt; & Lt; Employees & gt; & Lt; Employee name = "John" designation = "SE" & gt; & Lt; / Staff & gt; & Lt; Employee's name = "Adam" designation = "ASE" & gt; & Lt; / Staff & gt; & Lt; / Employees & gt; Enter #testTable r.value ('@ name', 'varchar (50)'), r.value ('@ designation', 'varchar (50)') @ xmldata.nodes ('/ employee / employee') T (r) Using this method, I have to pre-specify the column names when I manually use the value method.
Obtain a table with values as XML standards and data as the names of the method and column to run this query without specifying the value () method I want. . If it gets a job then I'm ready to convert it to Type XML. Assume that the XML column will always correspond to my current table.
Thanks in advance.
Comments
Post a Comment