How can I save data from xml to sql 2008?

SQL table:

[dbo].[Position](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [ImoNo] [numeric](8, 0) NOT NULL,
    [sid] [numeric](5, 0) NULL,
    [VesselName] [nvarchar](20) NULL,
    [time] [datetime] NOT NULL,
    [lat] [numeric](9, 2) NULL,
    [lon] [numeric](9, 2) NULL,
    [sog] [numeric](9, 2) NULL,
    [cog] [numeric](9, 2) NULL,
      [hdg] [numeric](9, 2) NULL,
    [eta] [datetime] NULL,
    [NextPort] [nvarchar](20) NULL)

XML file:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns1="http://www.fleettracker.de/api/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:GetPositionsResponse>
  <body>
    <result>Found 2 vessels.</result>
    <success>true</success>
    <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9456159</ns1:imono>
      <ns1:sid>780</ns1:sid>
      <ns1:name>Trenta</ns1:name>
      <ns1:charterShipName>Trenta</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1832900</lat>
        <lon>7570400</lon>
        <timestamp>2014-01-14T08:28:45Z</timestamp>
        <orderNumber>0</orderNumber>
        <sog>9.5</sog>
        <cog>22</cog>
        <hdg>22</hdg>
        <eta>2014-01-15T12:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1872560</lat>
        <lon>7589000</lon>
        <timestamp>2014-01-14T07:00:00Z</timestamp>
        <orderNumber>1</orderNumber>
        <sog>10.8</sog>
        <cog>25</cog>
        <hdg>25</hdg>
      </ns1:pasttrack>
    </shipsWithPositions>
 <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9144055</ns1:imono>
      <ns1:sid>789</ns1:sid>
      <ns1:name>Vipava</ns1:name>
      <ns1:charterShipName>Vipava</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1757160</lat>
        <lon>7536240</lon>
        <timestamp>2014-01-13T19:00:00Z</timestamp>
        <orderNumber>2</orderNumber>
        <sog>9.4</sog>
        <cog>21</cog>
        <hdg>21</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1658200</lat>
        <lon>7476480</lon>
        <timestamp>2014-01-13T07:00:00Z</timestamp>
        <orderNumber>3</orderNumber>
        <sog>8.4</sog>
        <cog>29</cog>
        <hdg>29</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1630000</lat>
        <lon>7455400</lon>
        <timestamp>2014-01-13T03:00:03Z</timestamp>
        <orderNumber>4</orderNumber>
        <sog>8.83</sog>
        <cog>34</cog>
        <hdg>34</hdg>
        <eta>2014-01-15T08:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
    </shipsWithPositions>
  </body>
</ns1:GetPositionsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I tried with this query, but it doesnt work:

DECLARE @xml XML
DECLARE @character VARCHAR(MAX)

SELECT @character = x.y
FROM OPENROWSET( BULK 'C:\Users\Nale\Desktop\POS.xml', SINGLE_CLOB ) x(y)

-- Fix up the ampersand
SELECT @xml = REPLACE( @character, '&', '&amp;' )


-- Get the tally information
SELECT 
x.y.value('ns1:imono/text())[1]', 'NUMERIC (8,0)') ImoNo,
x.y.value('ns1:sid/text())[1]', 'NUMERIC (5,0)') sid,
x.y.value('ns1:VesselName/text())[1]', 'NVARCHAR (20)') VesselName,
x.y.value('ns1:pasttrack/time/text())[1]', 'DATETIME') time,
x.y.value('ns1:pasttrack/lat/text())[1]', 'NUMERIC (9,2)') lat,
x.y.value('ns1:pasttrack/lon/text())[1]', 'NUMERIC (9,2)') lon,
x.y.value('ns1:pasttrack/sog/text())[1]', 'NUMERIC (9,2)') sog,
x.y.value('ns1:pasttrack/cog/text())[1]', 'NUMERIC (9,2)') cog,
x.y.value('ns1:pasttrack/hdg/text())[1]', 'NUMERIC (9,2)') hdg,
x.y.value('ns1:pasttrack/eta/text())[1]', 'DATETIME') eta,
x.y.value('ns1:pasttrack/NextPort/text())[1]', 'NVARCHAR (20)') NextPort
FROM @xml.nodes('SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetPositionsResponse/body/shipsWithPositions') AS x(y)

Any help?

Thanks

January 17th, 2014 5:55pm

See below for illustration

declare @x xml='<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns1="http://www.fleettracker.de/api/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:GetPositionsResponse>
  <body>
    <result>Found 2 vessels.</result>
    <success>true</success>
    <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9456159</ns1:imono>
      <ns1:sid>780</ns1:sid>
      <ns1:name>Trenta</ns1:name>
      <ns1:charterShipName>Trenta</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1832900</lat>
        <lon>7570400</lon>
        <timestamp>2014-01-14T08:28:45Z</timestamp>
        <orderNumber>0</orderNumber>
        <sog>9.5</sog>
        <cog>22</cog>
        <hdg>22</hdg>
        <eta>2014-01-15T12:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1872560</lat>
        <lon>7589000</lon>
        <timestamp>2014-01-14T07:00:00Z</timestamp>
        <orderNumber>1</orderNumber>
        <sog>10.8</sog>
        <cog>25</cog>
        <hdg>25</hdg>
      </ns1:pasttrack>
    </shipsWithPositions>
 <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9144055</ns1:imono>
      <ns1:sid>789</ns1:sid>
      <ns1:name>Vipava</ns1:name>
      <ns1:charterShipName>Vipava</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1757160</lat>
        <lon>7536240</lon>
        <timestamp>2014-01-13T19:00:00Z</timestamp>
        <orderNumber>2</orderNumber>
        <sog>9.4</sog>
        <cog>21</cog>
        <hdg>21</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1658200</lat>
        <lon>7476480</lon>
        <timestamp>2014-01-13T07:00:00Z</timestamp>
        <orderNumber>3</orderNumber>
        <sog>8.4</sog>
        <cog>29</cog>
        <hdg>29</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1630000</lat>
        <lon>7455400</lon>
        <timestamp>2014-01-13T03:00:03Z</timestamp>
        <orderNumber>4</orderNumber>
        <sog>8.83</sog>
        <cog>34</cog>
        <hdg>34</hdg>
        <eta>2014-01-15T08:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
    </shipsWithPositions>
  </body>
</ns1:GetPositionsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'


;WITH XMLNAMESPACES  ('http://schemas.xmlsoap.org/soap/envelope/' AS [SOAP-ENV],'http://www.fleettracker.de/api/1.0' as ns1,'http://www.w3.org/2001/XMLSchema-instance' as xsi)

INSERT[dbo].[Position](
    [ImoNo],
    [sid],
    [VesselName] ,
    [time] ,
    [lat],
    [lon] ,
    [sog] ,
    [cog] ,
      [hdg] ,
    [eta] ,
    [NextPort]
    )

SELECT u.value('(../ns1:imono)[1]','int') AS imono,
u.value('(../ns1:sid)[1]','int') AS sid,
u.value('(../ns1:name)[1]','varchar(50)') AS vesselName,
u.value('timestamp[1]','datetime') as [timestamp],
u.value('lat[1]','int') as lat,
u.value('lon[1]','int') as lon,
u.value('sog[1]','decimal(10,2)') as sog,
u.value('cog[1]','int') as cog,
u.value('hdg[1]','int') as hdg,
u.value('eta[1]','datetime') as eta,
u.value('nextport[1]','varchar(20)') as nextport
FROm @x.nodes('/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetPositionsResponse/body/shipsWithPositions/ns1:pasttrack')t(u)

Free Windows Admin Tool Kit Click here and download it now
January 17th, 2014 6:13pm


create table [dbo].[Position](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [ImoNo] [numeric](8, 0) NOT NULL,
    [sid] [numeric](5, 0) NULL,
    [VesselName] [nvarchar](20) NULL,
    [time] [datetime] NOT NULL,
    [lat] [numeric](9, 2) NULL,
    [lon] [numeric](9, 2) NULL,
    [sog] [numeric](9, 2) NULL,
    [cog] [numeric](9, 2) NULL,
      [hdg] [numeric](9, 2) NULL,
    [eta] [datetime] NULL,
    [NextPort] [nvarchar](20) NULL)

declare @x xml

set @x='<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns1="http://www.fleettracker.de/api/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:GetPositionsResponse>
  <body>
    <result>Found 2 vessels.</result>
    <success>true</success>
    <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9456159</ns1:imono>
      <ns1:sid>780</ns1:sid>
      <ns1:name>Trenta</ns1:name>
      <ns1:charterShipName>Trenta</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1832900</lat>
        <lon>7570400</lon>
        <timestamp>2014-01-14T08:28:45Z</timestamp>
        <orderNumber>0</orderNumber>
        <sog>9.5</sog>
        <cog>22</cog>
        <hdg>22</hdg>
        <eta>2014-01-15T12:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1872560</lat>
        <lon>7589000</lon>
        <timestamp>2014-01-14T07:00:00Z</timestamp>
        <orderNumber>1</orderNumber>
        <sog>10.8</sog>
        <cog>25</cog>
        <hdg>25</hdg>
      </ns1:pasttrack>
    </shipsWithPositions>
 <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9144055</ns1:imono>
      <ns1:sid>789</ns1:sid>
      <ns1:name>Vipava</ns1:name>
      <ns1:charterShipName>Vipava</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1757160</lat>
        <lon>7536240</lon>
        <timestamp>2014-01-13T19:00:00Z</timestamp>
        <orderNumber>2</orderNumber>
        <sog>9.4</sog>
        <cog>21</cog>
        <hdg>21</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1658200</lat>
        <lon>7476480</lon>
        <timestamp>2014-01-13T07:00:00Z</timestamp>
        <orderNumber>3</orderNumber>
        <sog>8.4</sog>
        <cog>29</cog>
        <hdg>29</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1630000</lat>
        <lon>7455400</lon>
        <timestamp>2014-01-13T03:00:03Z</timestamp>
        <orderNumber>4</orderNumber>
        <sog>8.83</sog>
        <cog>34</cog>
        <hdg>34</hdg>
        <eta>2014-01-15T08:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
    </shipsWithPositions>
  </body>
</ns1:GetPositionsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'


;WITH XMLNAMESPACES  ('http://schemas.xmlsoap.org/soap/envelope/' AS [SOAP-ENV],'http://www.fleettracker.de/api/1.0' as ns1,'http://www.w3.org/2001/XMLSchema-instance' as xsi)

INSERT[dbo].[Position](
    [ImoNo],
    [sid],
    [VesselName] ,
    [time] ,
    [lat],
    [lon] ,
    [sog] ,
    [cog] ,
      [hdg] ,
    [eta] ,
    [NextPort]
    )

SELECT u.value('(../ns1:imono)[1]','int') AS imono,
u.value('(../ns1:sid)[1]','int') AS sid,
u.value('(../ns1:name)[1]','varchar(50)') AS vesselName,
u.value('timestamp[1]','datetime') as [timestamp],
u.value('lat[1]','int') as lat,
u.value('lon[1]','int') as lon,
u.value('sog[1]','decimal(10,2)') as sog,
u.value('cog[1]','int') as cog,
u.value('hdg[1]','int') as hdg,
u.value('eta[1]','datetime') as eta,
u.value('nextport[1]','varchar(20)') as nextport
FROm @x.nodes('/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetPositionsResponse/body/shipsWithPositions/ns1:pasttrack')t(u)

-Prashanth

January 17th, 2014 6:34pm


create table [dbo].[Position](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [ImoNo] [numeric](8, 0) NOT NULL,
    [sid] [numeric](5, 0) NULL,
    [VesselName] [nvarchar](20) NULL,
    [time] [datetime] NOT NULL,
    [lat] [numeric](9, 2) NULL,
    [lon] [numeric](9, 2) NULL,
    [sog] [numeric](9, 2) NULL,
    [cog] [numeric](9, 2) NULL,
      [hdg] [numeric](9, 2) NULL,
    [eta] [datetime] NULL,
    [NextPort] [nvarchar](20) NULL)

declare @x xml

set @x='<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns1="http://www.fleettracker.de/api/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:GetPositionsResponse>
  <body>
    <result>Found 2 vessels.</result>
    <success>true</success>
    <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9456159</ns1:imono>
      <ns1:sid>780</ns1:sid>
      <ns1:name>Trenta</ns1:name>
      <ns1:charterShipName>Trenta</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1832900</lat>
        <lon>7570400</lon>
        <timestamp>2014-01-14T08:28:45Z</timestamp>
        <orderNumber>0</orderNumber>
        <sog>9.5</sog>
        <cog>22</cog>
        <hdg>22</hdg>
        <eta>2014-01-15T12:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1872560</lat>
        <lon>7589000</lon>
        <timestamp>2014-01-14T07:00:00Z</timestamp>
        <orderNumber>1</orderNumber>
        <sog>10.8</sog>
        <cog>25</cog>
        <hdg>25</hdg>
      </ns1:pasttrack>
    </shipsWithPositions>
 <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9144055</ns1:imono>
      <ns1:sid>789</ns1:sid>
      <ns1:name>Vipava</ns1:name>
      <ns1:charterShipName>Vipava</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1757160</lat>
        <lon>7536240</lon>
        <timestamp>2014-01-13T19:00:00Z</timestamp>
        <orderNumber>2</orderNumber>
        <sog>9.4</sog>
        <cog>21</cog>
        <hdg>21</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1658200</lat>
        <lon>7476480</lon>
        <timestamp>2014-01-13T07:00:00Z</timestamp>
        <orderNumber>3</orderNumber>
        <sog>8.4</sog>
        <cog>29</cog>
        <hdg>29</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1630000</lat>
        <lon>7455400</lon>
        <timestamp>2014-01-13T03:00:03Z</timestamp>
        <orderNumber>4</orderNumber>
        <sog>8.83</sog>
        <cog>34</cog>
        <hdg>34</hdg>
        <eta>2014-01-15T08:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
    </shipsWithPositions>
  </body>
</ns1:GetPositionsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'


;WITH XMLNAMESPACES  ('http://schemas.xmlsoap.org/soap/envelope/' AS [SOAP-ENV],'http://www.fleettracker.de/api/1.0' as ns1,'http://www.w3.org/2001/XMLSchema-instance' as xsi)

INSERT[dbo].[Position](
    [ImoNo],
    [sid],
    [VesselName] ,
    [time] ,
    [lat],
    [lon] ,
    [sog] ,
    [cog] ,
      [hdg] ,
    [eta] ,
    [NextPort]
    )

SELECT u.value('(../ns1:imono)[1]','int') AS imono,
u.value('(../ns1:sid)[1]','int') AS sid,
u.value('(../ns1:name)[1]','varchar(50)') AS vesselName,
u.value('timestamp[1]','datetime') as [timestamp],
u.value('lat[1]','int') as lat,
u.value('lon[1]','int') as lon,
u.value('sog[1]','decimal(10,2)') as sog,
u.value('cog[1]','int') as cog,
u.value('hdg[1]','int') as hdg,
u.value('eta[1]','datetime') as eta,
u.value('nextport[1]','varchar(20)') as nextport
FROm @x.nodes('/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetPositionsResponse/body/shipsWithPositions/ns1:pasttrack')t(u)

-Prashanth

Looks like copy paste of my suggestion with table defini
Free Windows Admin Tool Kit Click here and download it now
January 17th, 2014 6:55pm

Yes, I just added table definition and separated the declaration part where it was throwing error.

Thanks for your quick work.

-Prashanth

January 17th, 2014 7:13pm

declaration part will throw error only if you're below 2008

The posted code works fine for me without an

Free Windows Admin Tool Kit Click here and download it now
January 17th, 2014 7:14pm

Great solution!

Thanks Visakh16!

January 17th, 2014 8:39pm

Visakh16,

I have one more question.

If some of data in xml already exists in database,

how can I save to db only records that are not saved yet?

When I set primary keys (on imono and timestamp), if any <passtrack> is already in DB, I will not get the rest of xml to db.

If i do not set PK, I will get duplicated data in db.

How to resolve that?

Thanks

Free Windows Admin Tool Kit Click here and download it now
January 20th, 2014 6:03am

Try the below: (Small modification to Visakh's reply to accommodate the new req)

declare @x xml

set @x='<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns1="http://www.fleettracker.de/api/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:GetPositionsResponse>
  <body>
    <result>Found 2 vessels.</result>
    <success>true</success>
    <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9456159</ns1:imono>
      <ns1:sid>780</ns1:sid>
      <ns1:name>Trenta</ns1:name>
      <ns1:charterShipName>Trenta</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1832900</lat>
        <lon>7570400</lon>
        <timestamp>2014-01-14T08:28:45Z</timestamp>
        <orderNumber>0</orderNumber>
        <sog>9.5</sog>
        <cog>22</cog>
        <hdg>22</hdg>
        <eta>2014-01-15T12:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1872560</lat>
        <lon>7589000</lon>
        <timestamp>2014-01-14T07:00:00Z</timestamp>
        <orderNumber>1</orderNumber>
        <sog>10.8</sog>
        <cog>25</cog>
        <hdg>25</hdg>
      </ns1:pasttrack>
    </shipsWithPositions>
 <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9144055</ns1:imono>
      <ns1:sid>789</ns1:sid>
      <ns1:name>Vipava</ns1:name>
      <ns1:charterShipName>Vipava</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1757160</lat>
        <lon>7536240</lon>
        <timestamp>2014-01-13T19:00:00Z</timestamp>
        <orderNumber>2</orderNumber>
        <sog>9.4</sog>
        <cog>21</cog>
        <hdg>21</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1658200</lat>
        <lon>7476480</lon>
        <timestamp>2014-01-13T07:00:00Z</timestamp>
        <orderNumber>3</orderNumber>
        <sog>8.4</sog>
        <cog>29</cog>
        <hdg>29</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1630000</lat>
        <lon>7455400</lon>
        <timestamp>2014-01-13T03:00:03Z</timestamp>
        <orderNumber>4</orderNumber>
        <sog>8.83</sog>
        <cog>34</cog>
        <hdg>34</hdg>
        <eta>2014-01-15T08:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
    </shipsWithPositions>
  </body>
</ns1:GetPositionsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'
;WITH XMLNAMESPACES  ('http://schemas.xmlsoap.org/soap/envelope/' AS [SOAP-ENV],'http://www.fleettracker.de/api/1.0' as ns1,'http://www.w3.org/2001/XMLSchema-instance' as xsi)

,cte1
as
(

SELECT u.value('(../ns1:imono)[1]','int') AS imono,
u.value('(../ns1:sid)[1]','int') AS sid,
u.value('(../ns1:name)[1]','varchar(50)') AS vesselName,
u.value('timestamp[1]','datetime') as [timestamp],
u.value('lat[1]','int') as lat,
u.value('lon[1]','int') as lon,
u.value('sog[1]','decimal(10,2)') as sog,
u.value('cog[1]','int') as cog,
u.value('hdg[1]','int') as hdg,
u.value('eta[1]','datetime') as eta,
u.value('nextport[1]','varchar(20)') as nextport
FROm @x.nodes('/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetPositionsResponse/body/shipsWithPositions/ns1:pasttrack')t(u)
)
INSERT[dbo].[Position](
    [ImoNo],
    [sid],
    [VesselName] ,
    [time] ,
    [lat],
    [lon] ,
    [sog] ,
    [cog] ,
      [hdg] ,
    [eta] ,
    [NextPort]
    )
Select A.* From cte1 A
Left Join dbo.Position B On A.imono = B.imono and A.timestamp = B.time
Where B.Imono is null


January 20th, 2014 6:11am

Hi,

Furthermore, here is a example regarding read XML File using T-SQL. Please see:
http://blog.sqlauthority.com/2009/02/13/sql-server-simple-example-of-reading-xml-file-using-t-sql/

Regards,

Free Windows Admin Tool Kit Click here and download it now
January 20th, 2014 6:23am

Try the below: (Small modification to Visakh's reply to accommodate the new req)

declare @x xml

set @x='<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns1="http://www.fleettracker.de/api/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:GetPositionsResponse>
  <body>
    <result>Found 2 vessels.</result>
    <success>true</success>
    <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9456159</ns1:imono>
      <ns1:sid>780</ns1:sid>
      <ns1:name>Trenta</ns1:name>
      <ns1:charterShipName>Trenta</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1832900</lat>
        <lon>7570400</lon>
        <timestamp>2014-01-14T08:28:45Z</timestamp>
        <orderNumber>0</orderNumber>
        <sog>9.5</sog>
        <cog>22</cog>
        <hdg>22</hdg>
        <eta>2014-01-15T12:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1872560</lat>
        <lon>7589000</lon>
        <timestamp>2014-01-14T07:00:00Z</timestamp>
        <orderNumber>1</orderNumber>
        <sog>10.8</sog>
        <cog>25</cog>
        <hdg>25</hdg>
      </ns1:pasttrack>
    </shipsWithPositions>
 <shipsWithPositions xsi:type="ns1:FleettrackerShip">
      <ns1:imono>9144055</ns1:imono>
      <ns1:sid>789</ns1:sid>
      <ns1:name>Vipava</ns1:name>
      <ns1:charterShipName>Vipava</ns1:charterShipName>
      <ns1:pasttrack>
        <lat>1757160</lat>
        <lon>7536240</lon>
        <timestamp>2014-01-13T19:00:00Z</timestamp>
        <orderNumber>2</orderNumber>
        <sog>9.4</sog>
        <cog>21</cog>
        <hdg>21</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1658200</lat>
        <lon>7476480</lon>
        <timestamp>2014-01-13T07:00:00Z</timestamp>
        <orderNumber>3</orderNumber>
        <sog>8.4</sog>
        <cog>29</cog>
        <hdg>29</hdg>
      </ns1:pasttrack>
      <ns1:pasttrack>
        <lat>1630000</lat>
        <lon>7455400</lon>
        <timestamp>2014-01-13T03:00:03Z</timestamp>
        <orderNumber>4</orderNumber>
        <sog>8.83</sog>
        <cog>34</cog>
        <hdg>34</hdg>
        <eta>2014-01-15T08:00:00</eta>
        <nextport>KWANGYANG</nextport>
      </ns1:pasttrack>
    </shipsWithPositions>
  </body>
</ns1:GetPositionsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'
;WITH XMLNAMESPACES  ('http://schemas.xmlsoap.org/soap/envelope/' AS [SOAP-ENV],'http://www.fleettracker.de/api/1.0' as ns1,'http://www.w3.org/2001/XMLSchema-instance' as xsi)

,cte1
as
(

SELECT u.value('(../ns1:imono)[1]','int') AS imono,
u.value('(../ns1:sid)[1]','int') AS sid,
u.value('(../ns1:name)[1]','varchar(50)') AS vesselName,
u.value('timestamp[1]','datetime') as [timestamp],
u.value('lat[1]','int') as lat,
u.value('lon[1]','int') as lon,
u.value('sog[1]','decimal(10,2)') as sog,
u.value('cog[1]','int') as cog,
u.value('hdg[1]','int') as hdg,
u.value('eta[1]','datetime') as eta,
u.value('nextport[1]','varchar(20)') as nextport
FROm @x.nodes('/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetPositionsResponse/body/shipsWithPositions/ns1:pasttrack')t(u)
)
INSERT[dbo].[Position](
    [ImoNo],
    [sid],
    [VesselName] ,
    [time] ,
    [lat],
    [lon] ,
    [sog] ,
    [cog] ,
      [hdg] ,
    [eta] ,
    [NextPort]
    )
Select A.* From cte1 A
Left Join dbo.Position B On A.imono = B.imono and A.timestamp = B.time
Where B.Imono is null


January 20th, 2014 2:05pm

Latheesh NK,

thanks alot!!

Free Windows Admin Tool Kit Click here and download it now
January 20th, 2014 2:49pm

I think there are a few issues with the proposed solutions.  I would do it more like this:

  • Don't use parent access operator (..) as per here; this can have serious impact on performance
  • Instead use multiple CROSS|OUTER APPLY to drill down into the xml left to right; see below
  • Use text() accessor and [1] ordinal for performance as per here
  • put data into temp table first to ensure you are not doing xml shred AND INSERT at same time
  • Add primary key to temp table to ensure no duplicates in input data

Something like this:

USE tempdb
GO

IF OBJECT_ID('tempdb.[dbo].[Position]') IS NOT NULL DROP TABLE [dbo].[Position]
IF OBJECT_ID('tempdb..#tmp') IS NOT NULL DROP TABLE #tmp
GO

CREATE TABLE #tmp(
    [ImoNo] [numeric](8, 0) NOT NULL,
    [sid] [numeric](5, 0) NULL,
    [VesselName] [nvarchar](20) NULL,
    [time] [datetime] NOT NULL,
    [lat] [numeric](9, 2) NULL,
    [lon] [numeric](9, 2) NULL,
    [sog] [numeric](9, 2) NULL,
    [cog] [numeric](9, 2) NULL,
    [hdg] [numeric](9, 2) NULL,
    [eta] [datetime] NULL,
    [NextPort] [nvarchar](20) NULL,

	PRIMARY KEY ( ImoNo, [time] )
	)
GO

CREATE TABLE [dbo].[Position](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [ImoNo] [numeric](8, 0) NOT NULL,
    [sid] [numeric](5, 0) NULL,
    [VesselName] [nvarchar](20) NULL,
    [time] [datetime] NOT NULL,
    [lat] [numeric](9, 2) NULL,
    [lon] [numeric](9, 2) NULL,
    [sog] [numeric](9, 2) NULL,
    [cog] [numeric](9, 2) NULL,
    [hdg] [numeric](9, 2) NULL,
    [eta] [datetime] NULL,
    [NextPort] [nvarchar](20) NULL,

	PRIMARY KEY ( ImoNo, [time] )
	)
GO

DECLARE @xml XML

SELECT @xml = x.y
FROM OPENROWSET( BULK 'c:\temp\temp.xml', SINGLE_CLOB ) x(y)


;WITH XMLNAMESPACES 
(
	'http://schemas.xmlsoap.org/soap/envelope/' AS "SOAP-ENV",
	'http://www.fleettracker.de/api/1.0' AS ns1
)
INSERT INTO #tmp ( ImoNo, [sid], VesselName, [time], lat, lon, sog, cog, hdg, eta, NextPort )
SELECT
	swp.c.value('(ns1:imono/text())[1]', 'NUMERIC (8,0)') AS imono,
	swp.c.value('(ns1:sid/text())[1]', 'NUMERIC (8,0)') AS [sid],
	swp.c.value('(ns1:charterShipName/text())[1]', 'NVARCHAR(20)') AS charterShipName,
	p.c.value('(timestamp/text())[1]', 'DATETIME') AS [time],
	p.c.value('(lat/text())[1]', 'NUMERIC(9,2)') AS lat,
	p.c.value('(lon/text())[1]', 'NUMERIC(9,2)') AS lon,
	p.c.value('(sog/text())[1]', 'NUMERIC(9,2)') AS sog,
	p.c.value('(cog/text())[1]', 'NUMERIC(9,2)') AS cog,
	p.c.value('(hdg/text())[1]', 'NUMERIC(9,2)') AS hdg,
	p.c.value('(eta/text())[1]', 'DATETIME') AS eta,
	p.c.value('(nextport/text())[1]', 'NVARCHAR(20)') AS nextport

FROM @xml.nodes('SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetPositionsResponse/body') b(c)
	CROSS APPLY b.c.nodes('shipsWithPositions') swp(c)
		CROSS APPLY swp.c.nodes('ns1:pasttrack') p(c)


INSERT INTO dbo.Position ( ImoNo, [sid], VesselName, [time], lat, lon, sog, cog, hdg, eta, NextPort )
SELECT ImoNo, [sid], VesselName, [time], lat, lon, sog, cog, hdg, eta, NextPort
FROM #tmp t
WHERE NOT EXISTS
	(
	SELECT 1
	FROM dbo.Position p
	WHERE t.ImoNo = p.ImoNo
	AND t.[time] = p.[time]
	)

You might think some of my proposed changes are cosmetic but the parent access operator and text() accessor recommendations alone can vastly improve performance particularly with larger pieces of XML.

January 20th, 2014 3:43pm

wBob,

I am trying to implement your code on another xml,

but I am getting only one (1st) data in DB.

Can you tell me, what I am doing wrong?

XML:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.fleettracker.de/api/1.0">
	<SOAP-ENV:Body>
		<ns1:GetScheduleResponse>
			<body>
				<requestData>
					<imoNo>9144304</imoNo>
				</requestData>
				<currentSchedule>
					<ns1:SCHEDULE_ID>2247</ns1:SCHEDULE_ID>
					<ns1:changed>2014-01-18T13:35:05</ns1:changed>
					<ns1:ELEMENT>
						<ns1:ELEMENT_ID>443262255</ns1:ELEMENT_ID>
						<ns1:voyageNumber>4148</ns1:voyageNumber>
						<ns1:HARBOUR>PORT ELIZABETH</ns1:HARBOUR>
						<ns1:DEST_TYPE>HARBOUR</ns1:DEST_TYPE>
						<ns1:STATECODE/>
						<ns1:UNLOCATIONCODE>PLZ</ns1:UNLOCATIONCODE>
						<ns1:COUNTRYCODE>ZA</ns1:COUNTRYCODE>
						<ns1:COUNTRYNAME>SOUTH AFRICA</ns1:COUNTRYNAME>
						<ns1:DEST_POSITION>
							<lat>-2038002</lat>
							<lon>1537998</lon>
						</ns1:DEST_POSITION>
						<ns1:ETA>2014-01-18T14:00:00</ns1:ETA>
						<ns1:ETD>2014-01-21T12:00:00</ns1:ETD>
						<ns1:ETB>2014-01-18T14:00:00</ns1:ETB>
						<ns1:ARRIVED>true</ns1:ARRIVED>
						<ns1:LEFT>false</ns1:LEFT>
						<ns1:CANCELED>false</ns1:CANCELED>
						<ns1:COMMENT/>
						<ns1:PORT_CALL_NOT_FIXED_YET>false</ns1:PORT_CALL_NOT_FIXED_YET>
						<ns1:AGENT>
							<ns1:AGENTID>42101</ns1:AGENTID>
						</ns1:AGENT>
					</ns1:ELEMENT>
					<ns1:ELEMENT>
						<ns1:ELEMENT_ID>442515778</ns1:ELEMENT_ID>
						<ns1:voyageNumber>4148</ns1:voyageNumber>
						<ns1:HARBOUR>CAPE TOWN</ns1:HARBOUR>
						<ns1:DEST_TYPE>HARBOUR</ns1:DEST_TYPE>
						<ns1:STATECODE/>
						<ns1:UNLOCATIONCODE>CPT</ns1:UNLOCATIONCODE>
						<ns1:COUNTRYCODE>ZA</ns1:COUNTRYCODE>
						<ns1:COUNTRYNAME>SOUTH AFRICA</ns1:COUNTRYNAME>
						<ns1:DEST_POSITION>
							<lat>-2035002</lat>
							<lon>1105997</lon>
						</ns1:DEST_POSITION>
						<ns1:ETA>2014-01-13T15:00:00</ns1:ETA>
						<ns1:ETD>2014-01-16T21:40:00</ns1:ETD>
						<ns1:ETB>2014-01-15T08:00:00</ns1:ETB>
						<ns1:ARRIVED>true</ns1:ARRIVED>
						<ns1:LEFT>true</ns1:LEFT>
						<ns1:CANCELED>false</ns1:CANCELED>
						<ns1:COMMENT/>
						<ns1:PORT_ACTIVITIES>DISCHARGING</ns1:PORT_ACTIVITIES>
						<ns1:PORT_CALL_NOT_FIXED_YET>false</ns1:PORT_CALL_NOT_FIXED_YET>
						<ns1:AGENT>
							<ns1:AGENTID>41866</ns1:AGENTID>
						</ns1:AGENT>
					</ns1:ELEMENT>
				</currentSchedule>
			</body>
		</ns1:GetScheduleResponse>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

SQL query:

USE temp
GO

IF OBJECT_ID('temp..#tmp') IS NOT NULL DROP TABLE #tmp
GO

CREATE TABLE #tmp(
    [ImoNo] [numeric](8, 0) NOT NULL,
	[ScheduleID] [numeric](8, 0) NOT NULL,
	[ElementID] [numeric](12, 0) NOT NULL,
	[Time] [datetime] NULL,
	[DestType] [nvarchar](20) NULL,
	[Harbour] [nvarchar](20) NULL,
	[LocationCode] [nvarchar](4) NULL,
	[CountryCode] [nvarchar](4) NULL,
	[CountryName] [nvarchar](20) NULL,
	[DestPosLAT] [numeric](9, 2) NULL,
	[DestPosLON] [numeric](9, 2) NULL,
	[DestPosETA] [datetime] NULL,
	[DestPosETD] [datetime] NULL,
	[DestPosETB] [datetime] NULL,
	[DestPosArrived] [nvarchar](10) NULL,
	[DestPosLeft] [nvarchar](10) NULL,
	[DestPosCanceled] [nvarchar](10) NULL,
	[Comment] [nvarchar](max) NULL,
	[PortCallNotFixedYet] [nvarchar](10) NULL,
	[AgentID] [numeric](8, 0) NULL,
	PRIMARY KEY ( ImoNo, ScheduleID, ElementID )
	)
GO



DECLARE @xml XML

SELECT @xml = x.y
FROM OPENROWSET( BULK 'C:\temp\temp.xml', SINGLE_CLOB ) x(y)


;WITH XMLNAMESPACES  (
					  'http://schemas.xmlsoap.org/soap/envelope/' AS [SOAP-ENV],
					  'http://www.fleettracker.de/api/1.0' as ns1
					  )

INSERT INTO #tmp (
            [ImoNo]
           ,[ScheduleID]
           ,[ElementID]
           ,[Time]
           ,[DestType]
           ,[Harbour]
           ,[LocationCode]
           ,[CountryCode]
           ,[CountryName]
           ,[DestPosLAT]
           ,[DestPosLON]
           ,[DestPosETA]
           ,[DestPosETD]
           ,[DestPosETB]
           ,[DestPosArrived]
           ,[DestPosLeft]
           ,[DestPosCanceled]
           ,[Comment]
           ,[PortCallNotFixedYet]
           ,[AgentID] )
SELECT
	swp.c.value('(imoNo/text())[1]', 'NUMERIC (8,0)') AS imoNo,
	p.c.value('(ns1:SCHEDULE_ID/text())[1]', 'NUMERIC (8,0)') AS ScheduleID,
	p.c.value('(ns1:ELEMENT/ns1:ELEMENT_ID/text())[1]', 'NUMERIC (12,0)') AS ElementID,
	p.c.value('(ns1:changed/text())[1]', 'DATETIME') AS [Time],
	p.c.value('(ns1:ELEMENT/ns1:DEST_TYPE/text())[1]', '[nvarchar](20)') AS DestType,
	p.c.value('(ns1:ELEMENT/ns1:HARBOUR/text())[1]', '[nvarchar](20)') AS Harbour,
	p.c.value('(ns1:ELEMENT/ns1:UNLOCATIONCODE/text())[1]', '[nvarchar](4)') AS LocationCode,
	p.c.value('(ns1:ELEMENT/ns1:COUNTRYCODE/text())[1]', '[nvarchar](4)') AS CountryCode,
	p.c.value('(ns1:ELEMENT/ns1:COUNTRYNAME/text())[1]', '[nvarchar](20)') AS CountryName,
	p.c.value('(ns1:ELEMENT/ns1:DEST_POSITION/lat/text())[1]', 'numeric(9,2)') AS DestPosLAT,
	p.c.value('(ns1:ELEMENT/ns1:DEST_POSITION/lon/text())[1]', 'numeric(9,2)') AS DestPosLON,
	p.c.value('(ns1:ELEMENT/ns1:ETA/text())[1]', 'DATETIME') AS DestPosETA,
	p.c.value('(ns1:ELEMENT/ns1:ETD/text())[1]', 'DATETIME') AS DestPosETD,
	p.c.value('(ns1:ELEMENT/ns1:ETB/text())[1]', 'DATETIME') AS DestPosETB,
	p.c.value('(ns1:ELEMENT/ns1:ARRIVED/text())[1]', '[nvarchar](10)') AS DestPosArrived,
	p.c.value('(ns1:ELEMENT/ns1:LEFT/text())[1]', '[nvarchar](10)') AS DestPosLeft,
	p.c.value('(ns1:ELEMENT/ns1:CANCELED/text())[1]', '[nvarchar](10)') AS DestPosCanceled,
	p.c.value('(ns1:ELEMENT/ns1:COMMENT/text())[1]', '[nvarchar](max)') AS Comment,
	p.c.value('(ns1:ELEMENT/ns1:PORT_CALL_NOT_FIXED_YET/text())[1]', '[nvarchar](10)') AS PortCallNotFixedYet,
	p.c.value('(ns1:ELEMENT/ns1:AGENT/ns1:AGENTID/text())[1]', 'numeric(8,0)') AS AgentID

FROM @xml.nodes('SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetScheduleResponse/body') b(c)
	CROSS APPLY b.c.nodes('requestData') swp(c)	
		CROSS APPLY swp.c.nodes('../currentSchedule') p(c)


		
INSERT INTO dbo.ShipSchedule
			([ImoNo]
           ,[ScheduleID]
           ,[ElementID]
           ,[Time]
           ,[DestType]
           ,[Harbour]
           ,[LocationCode]
           ,[CountryCode]
           ,[CountryName]
           ,[DestPosLAT]
           ,[DestPosLON]
           ,[DestPosETA]
           ,[DestPosETD]
           ,[DestPosETB]
           ,[DestPosArrived]
           ,[DestPosLeft]
           ,[DestPosCanceled]
           ,[Comment]
           ,[PortCallNotFixedYet]
           ,[AgentID])
SELECT [ImoNo]
           ,[ScheduleID]
           ,[ElementID]
           ,[Time]
           ,[DestType]
           ,[Harbour]
           ,[LocationCode]
           ,[CountryCode]
           ,[CountryName]
           ,[DestPosLAT]
           ,[DestPosLON]
           ,[DestPosETA]
           ,[DestPosETD]
           ,[DestPosETB]
           ,[DestPosArrived]
           ,[DestPosLeft]
           ,[DestPosCanceled]
           ,[Comment]
           ,[PortCallNotFixedYet]
           ,[AgentID]
FROM #tmp t
WHERE NOT EXISTS
	(
	SELECT 1
	FROM dbo.ShipSchedule p
	WHERE t.ImoNo = p.ImoNo
	AND t.ScheduleID = p.ScheduleID
	AND t.ElementID = p.ElementID
	)
	

DROP TABLE #tmp

Free Windows Admin Tool Kit Click here and download it now
January 21st, 2014 7:14am

Just for curiosity: Where do you get those XML files from?
January 21st, 2014 8:00am

From www.fleettracker.de SOAP request
Free Windows Admin Tool Kit Click here and download it now
January 21st, 2014 8:25am

Then you should have access to the data already in an object graph in your retrival code . btw, .NET, Java or anything else?
January 21st, 2014 8:45am

Try this:

SELECT
	b.c.value('(requestData/imoNo/text())[1]', 'NUMERIC (8,0)') AS imoNo,
	cs.c.value('(ns1:SCHEDULE_ID/text())[1]', 'NUMERIC (8,0)') AS ScheduleID,
	e.c.value('(ns1:ELEMENT_ID/text())[1]', 'NUMERIC (12,0)') AS ElementID,
	cs.c.value('(ns1:changed/text())[1]', 'DATETIME') AS [Time],
	e.c.value('(ns1:DEST_TYPE/text())[1]', '[nvarchar](20)') AS DestType,
	e.c.value('(ns1:HARBOUR/text())[1]', '[nvarchar](20)') AS Harbour,
	e.c.value('(ns1:UNLOCATIONCODE/text())[1]', '[nvarchar](4)') AS LocationCode,
	e.c.value('(ns1:COUNTRYCODE/text())[1]', '[nvarchar](4)') AS CountryCode,
	e.c.value('(ns1:COUNTRYNAME/text())[1]', '[nvarchar](20)') AS CountryName,
	e.c.value('(ns1:DEST_POSITION/lat/text())[1]', 'numeric(9,2)') AS DestPosLAT,
	e.c.value('(ns1:DEST_POSITION/lon/text())[1]', 'numeric(9,2)') AS DestPosLON,
	e.c.value('(ns1:ETA/text())[1]', 'DATETIME') AS DestPosETA,
	e.c.value('(ns1:ETD/text())[1]', 'DATETIME') AS DestPosETD,
	e.c.value('(ns1:ETB/text())[1]', 'DATETIME') AS DestPosETB,
	e.c.value('(ns1:ARRIVED/text())[1]', '[nvarchar](10)') AS DestPosArrived,
	e.c.value('(ns1:LEFT/text())[1]', '[nvarchar](10)') AS DestPosLeft,
	e.c.value('(ns1:CANCELED/text())[1]', '[nvarchar](10)') AS DestPosCanceled,
	e.c.value('(ns1:COMMENT/text())[1]', '[nvarchar](max)') AS Comment,
	e.c.value('(ns1:PORT_CALL_NOT_FIXED_YET/text())[1]', '[nvarchar](10)') AS PortCallNotFixedYet,
	e.c.value('(ns1:AGENT/ns1:AGENTID/text())[1]', 'numeric(8,0)') AS AgentID

FROM @xml.nodes('SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetScheduleResponse/body') b(c)
	CROSS APPLY b.c.nodes('currentSchedule') cs(c)
		CROSS APPLY cs.c.nodes('ns1:ELEMENT') e(c)

I think you need to spend a bit more time understanding XQuery.  Try these articles which helped me:

Introduction to XQuery in SQL Server 2005
http://msdn.microsoft.com/en-us/library/ms345122(SQL.90).aspx

XQuery Labs - A Collection of XQuery Sample Scripts
http://beyondrelational.com/modules/2/blogs/28/posts/10279/xquery-labs-a-collection-of-xquery-sample-scripts.aspx

Free Windows Admin Tool Kit Click here and download it now
January 21st, 2014 8:56am

Stefan,

I am getting xml through php web service, which I call manually. Basically I'm not a programmer, justplaying with the things that are needed by my company, and I have a desire to learn. Is there a way to call a php service directly through SQL query?

January 22nd, 2014 3:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics