Posts

Showing posts with the label sql xml

Aggregate field to comma separated text

--Works good with numbers, careful with text due to xml-conversion select stuff( ( select ','+AnimalId from dbo.Animal as a for xml path('') ), 1,1,'') AS AggregatedAnimalIdsAsString

Trouble extracting xml data when it has different namespaces?

Ignore namespaces! "select @xmlDoc.query('data(/*:authors/*:child/*:id)') as UserID" from blog post  http://maxbarrass.blogspot.se/2008/02/sql-2005-xml-xquery-ignore-namespaces.html