Skip to content

Instantly share code, notes, and snippets.

@samlam
Last active August 29, 2015 14:01
Show Gist options
  • Save samlam/3d89240e31170d2060b4 to your computer and use it in GitHub Desktop.
Save samlam/3d89240e31170d2060b4 to your computer and use it in GitHub Desktop.
SQL Xml datatype
Declare @Sizings XML
Select @Sizings = N'<Sizings><SDLC>Early Stage Analysis</SDLC><Estimate>10</Estimate></Sizings><Sizings><SDLC>Approach and Sizing</SDLC><Estimate>100</Estimate></Sizings>'
select
Estimate = a.b.value('Estimate[1]','numeric(18,6)')
,SDLC = a.b.value('SDLC[1]','nvarchar(500)')
from @Sizings.nodes('Sizings') a(b)
select convert(nvarchar(500),@Sizings.query('data(/Sizings/SDLC)') )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment