1

Topic: MS2008R2 To receive the table from XML

There is table Shop of type id (int), shops (xml)
xml type

<Shops>
<Shop> 2 </Shop>
<Shop> 3 </Shop>
<Shop> 6 </Shop>
<Shop> 7 </Shop>
<Shop> 9 </Shop>
<Shop> 10 </Shop>
</Shops>

It is necessary to receive
Type sampling id, shop in the form of the table on all Shop for everyone Id

2

Re: MS2008R2 To receive the table from XML

philips wrote:

There is table Shop of type id (int), shops (xml)
xml type

<Shops>
<Shop> 2 </Shop>
<Shop> 3 </Shop>
<Shop> 6 </Shop>
<Shop> 7 </Shop>
<Shop> 9 </Shop>
<Shop> 10 </Shop>
</Shops>

It is necessary to receive
Type sampling id, shop in the form of the table on all Shop for everyone Id

At me just the modem  to the Internet!
https://dzone.com/articles/sql-query-to … l-to-table

3

Re: MS2008R2 To receive the table from XML

Probably I not so only  on SQL, but I need to receive request from the table (instead of a variable), and  every line

4

Re: MS2008R2 To receive the table from XML

philips;
My God well esteem help your question from that discharge on which to give the direct code already simply indecently.
https://docs.microsoft.com/ru-ru/sql/t- … pe-methods

5

Re: MS2008R2 To receive the table from XML

philips wrote:

I am possible not so only  on SQL, but I need to receive request from the table (instead of a variable), and  every line

At you that spherical xml in vacuum?
At you fields of the table of data type xml?
Or where  <Shops> ?

6

Re: MS2008R2 To receive the table from XML

Yes in the field Shops it is written down XML. This application 10 summer prescription, in this time I simply forgot all syntax SQL XML

7

Re: MS2008R2 To receive the table from XML

philips;

select
s. [id] AS [ID];
T.c.value (' (./TEXT() [1] ', ' INT ') AS [Shop_ID]
from [dbo]. [Shop] s
cross apply s. [shops].nodes ('/Shops/Shop ') T (c)

8

Re: MS2008R2 To receive the table from XML

Thanks the kind person from the former encoder in SQL, and now stupid  1