Skip to content

Instantly share code, notes, and snippets.

@minhajuddin
Created July 22, 2010 16:15
Show Gist options
  • Select an option

  • Save minhajuddin/486179 to your computer and use it in GitHub Desktop.

Select an option

Save minhajuddin/486179 to your computer and use it in GitHub Desktop.
declare @foo xml
select @foo='<ext><name><first>Khaja</first><last>Minhajuddin</last></name><age>25</age></ext>';
select @foo.value('(//ext/name/first)[1]','varchar(50)') 'First Name',
@foo.value('(//ext/name/last)[1]','varchar(50)') 'Last Name',
@foo.value('(//ext/age)[1]','integer') 'Age';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment