Skip to content

Instantly share code, notes, and snippets.

@vadimii
Created July 10, 2012 16:18
Show Gist options
  • Save vadimii/3084424 to your computer and use it in GitHub Desktop.
Save vadimii/3084424 to your computer and use it in GitHub Desktop.
Extract tags for row from YAML XML column
create view ProjectDescriptionSectionTags
as select
pds.ProjectID,
cs.ID as SectionID,
U.V.value('./text()[1]', 'nvarchar(100)') as Tag
from ProjectDescriptionSection pds
inner join ContentSection cs on cs.ID = pds.ID
cross apply cs.XmlConf.nodes(N'//key') as T(K)
cross apply T.K.nodes('../value/sequence/item') as U(V)
where T.K.exist('.="tags"') = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment