Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Need help in xml Expand / Collapse
Author
Message
Posted Monday, December 03, 2012 4:31 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 5:11 AM
Points: 206, Visits: 387
DECLARE @myDoc xml
DECLARE @AppName VARCHAR(100)
SET @myDoc = '<assembly xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyidentity version="2.2.2.2" Appname="Application2.app">
</assemblyidentity></assembly>'

SET @AppName = @myDoc.value('(/assembly/assemblyidentity/@Appname)[1]', 'char(150)' )
SELECT @AppName

may i know what is wrong in this xml
Post #1391846
Posted Monday, December 03, 2012 5:30 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 08, 2014 6:13 AM
Points: 1,694, Visits: 19,550
You need a namespace declaration

SET @AppName =  @myDoc.value('declare default element namespace "urn:schemas-microsoft-com:asm.v1";
(/assembly/assemblyidentity/@Appname)[1]', 'char(150)' )
SELECT @AppName



____________________________________________________

How to get the best help on a forum

http://www.sqlservercentral.com/articles/Best+Practices/61537

Never approach a goat from the front, a horse from the rear, or a fool from any direction.
Post #1391860
Posted Monday, December 03, 2012 5:53 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 5:11 AM
Points: 206, Visits: 387
thanks for you assistance i am just learning now how to use xml in sqlserver please assist me, can give some link to see like this kind of stuff
Post #1391881
Posted Monday, December 03, 2012 6:10 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 08, 2014 6:13 AM
Points: 1,694, Visits: 19,550


Have a look here


http://msdn.microsoft.com/en-us/library/ms345122(v=sql.90).aspx


____________________________________________________

How to get the best help on a forum

http://www.sqlservercentral.com/articles/Best+Practices/61537

Never approach a goat from the front, a horse from the rear, or a fool from any direction.
Post #1391893
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse