Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 reading xml document using procedure

Author  Topic 

msrs

32 Posts

Posted - 2007-10-08 : 06:34:31
hi all,

I need a built-in function which is given output of xml node value when i am sending a parameters ... xml document and node name.
example :

xml document
<employee>
<eno> 1 </eno>
<ename> dddd </ename>
<salary> 10000 </salary>
</employee>

I will give this xml document and node name (for eg: ename) to buil-in function. I want output 10000.

any built -in function like ... in mssql 2000.



Thanks&Regards,

Msrs

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-08 : 06:55:13
See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=90375&SearchTerms=OpenXML



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

msrs

32 Posts

Posted - 2007-10-08 : 07:07:47
thanks peso,

when we are using openxml we need to know the node name and that data type. But in my requirement we don't know structe of the xml document, node name and data type. openxml is not satisfied for my requirement.



Thanks&Regards,

Msrs
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-08 : 07:12:19
[code]DECLARE @SQL VARCHAR(8000)

SET @SQL = '<employee><eno>1</eno><ename>dddd</ename><salary>10000</salary></employee>'

SELECT @SQL,
SUBSTRING(@SQL, PATINDEX('%<salary>%', @SQL) + 8, PATINDEX('%</salary>%', @SQL) - PATINDEX('%<salary>%', @SQL) - 8)[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -