Home Select statement on XML not returning desired output
Reply: 0

Select statement on XML not returning desired output

user488
1#
user488 Published in June 23, 2018, 9:19 pm
DECLARE @barcode XML

            SET @barcode = '<BCODES><BCODE>a</BCODE><BCODE>b</BCODE><BCODE>c</BCODE><BCODE>d</BCODE></BCODES>'

            --INSERT INTO #barcode
            SELECT      v.x.value('BCODE[1]','VARCHAR(15)') AS Barcodes
            FROM        @barcode.nodes('BCODES') v(x)

Result-->

Barcodes

a

I'm unable to get b,c and d in the output.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.330941 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO