SQL Get XML value

Source: Internet
Author: User

ALTER PROCEDURE [dbo]. [Addr_sp_contactor_addmutilfield]
@SeqNo INT,
@CompID INT,
@ContactorID BIGINT,
@ContactWay XML,
@ConfParticipatePhoneNo VARCHAR (50)
As
SET NOCOUNT on
/*
<ContactWay>
<Way>
<WayType>1</WayType>
<WayField>13810712519</WayField>
</Way>
<Way>
<WayType>3</WayType>
<wayfield>[email protected]</wayfield>
</Way>
</ContactWay>
*/
DELETE dbo. Addr_tb_contactfield
WHERE seqno = @SeqNo
and compid = @CompID
and Contactorid = @ContactorID

INSERT into dbo. Addr_tb_contactfield
(Contactorid,
Seqno,
Compid,
Field,
FieldType
)
SELECT @ContactorID,
@SeqNo,
@CompID,
Field = T.c.value (' (./wayfield/text ()) [1] ', ' VARCHAR (200) '),
FieldType = T.c.value (' (./waytype/text ()) [1] ', ' INT ')
From @ContactWay. Nodes ('/contactway/way ') as T (c)

SQL Get XML value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.