how to read this xml in sql server -
how to read this xml in sql server -
i having xml result webservice api . need parse result , update database table. xml below . response text.
<?xml version="1.0" encoding="utf-8"?> <double>1</double>
sqlserver 2008 code :
declare @xml xml, @rate decimal(10,4) set @xml=replace(@responsetext ,'encoding="utf-8"','') select @rate= @xml.value('(/double)[1]','decimal')
i want value of double homecoming null .
please help me out .
hi , have done changes per suggestion still no getting.
declare @xml xml declare @responsetext varchar(900) declare @rate decimal(10,4) set @responsetext = '<?xml version="1.0" encoding="utf-8"?> <double xmlns="http://www.webservicex.net/">1</double>' set @xml=replace(@responsetext ,'encoding="utf-8"','') select @rate= @xml.value('(/double)[1]','decimal') select @rate
declare @x xml = '<?xml version="1.0" encoding="utf-8"?> <double xmlns="http://www.webservicex.net/">1</double>' select @x.value ('declare namespace x="http://www.webservicex.net/"; (/x:double)[1]', 'decimal')
updated reflect utilize of namespace; general point don't need string manipulation create work. header supported. however, namespaces important.
sql sql-server-2008
Comments
Post a Comment