Syntax for XML query in SQL

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

Add comment

  Country flag


  • Comment
  • Preview
Loading