Syntax for XML query in SQL

by alski 10. September 2009 13:39

Use the following

SELECT Doc.value('data((/OrganisationAccountOpeningForm/KYCCustomer/EntryDate)[1])','datetime')

or syntactically

SELECT <XML Column Name>.value('data((/<XPATH>)[<1-based index into possible values returned>])','<Format to convert the XML value into>')

See also http://msdn.microsoft.com/en-us/library/ms345117(SQL.90).aspx

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Code | SQL | Work

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

RecentComments

Comment RSS