April 30, 2015 at 5:02 am
Hi,
this problem perplex me for a long time, can you help me?
I want to query a column of xml files in a table,
use mysql1
declare @bp xml
select @bp=xml
;WITH XMLNAMESPACES('http://schemas.openehr.org/v1' as bp,'http://www.w3.org/2001/XMLSchema-instance' as xsi,'OBSERVATION' as type)
select * from (
select
m.c.value('(./bp:data/bp:items[1]/bp:value[1]/bp:magnitude)[1]','int') as systolisch
from
BloodpressureMitSchema cross apply
@bp.nodes('/bp:content/bp:data/bp:events') as m(c))m
but with this "cross apply" I can only query all the values in one xml and repeat them. Is there something wrong at "declear"
thanks all
May 1, 2015 at 2:07 am
Quick suggestion
😎
use mysql1
;WITH XMLNAMESPACES('http://schemas.openehr.org/v1' as bp,'http://www.w3.org/2001/XMLSchema-instance' as xsi,'OBSERVATION' as type)
select * from (
select
m.c.value('(/bp:magnitude/text())','int') as systolisch
from
[schema_name].[table_name] [alias]
cross apply [alias].[xml column name].nodes('/bp:content/bp:data/bp:events/bp:data/bp:items/bp:value') as m(c))m;
May 1, 2015 at 6:07 am
It works. Thanks alot 🙂
I thought to much
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply