DECLARE @ItemMessage XML;
--DECLARE @ItemTable TABLE(ItemNumber INT PRIMARY KEY,ItemDescription NVARCHAR(300))
SET @ItemMessage
= N'
<root xmlns="http://cd.love.com/SOA">
<node>
<materailID>1</materailID>
<batchNo>3</batchNo>
<quantity>6</quantity>
</node>
<node>
<materailID>2</materailID>
<batchNo>3</batchNo>
<quantity>5</quantity>
</node>
<node>
<materailID>3</materailID>
<batchNo>3</batchNo>
<quantity>4</quantity>
</node>
</root>
';
DECLARE @va1 NVARCHAR(64),
@va2 NVARCHAR(64),
@va3 DECIMAL(18, 4);
WITH XMLNAMESPACES
(
DEFAULT 'http://cd.love.com/SOA'
)
INSERT INTO dbo.CO_IG_ZF_Electric
(
BarCode,
PointAdress,
PointValue,
EXT1,
EXT2,
EXT3
)
SELECT T.c.value('(materailID/text())[1]', 'NVARCHAR(64)'),
T.c.value('(batchNo/text())[1]', 'NVARCHAR(64)'),
T.c.value('(quantity/text())[1]', 'DECIMAL(18,4)'),
'1231312',
'ttttttt',
'cccccc'
FROM @ItemMessage.nodes('/root/node') AS T(c);
--SELECT ItemNumber,
--ItemDescription
--FROM @ItemTable