XML in Text field

  • In my database from my software vendor, there is a text filed but they are putting XML into this field. I would like to know if there is any way of getting this information out of the field into a workable table with the XML nodes as column headings.

  • I haven't tried it yet but can you do a select of the field while casting to an xml datatype?

  • Why not put the xml text into an xml data type field in another table? From there you should be able to use the many new xml tools in sql 2005 to do whatever you want to it.

    I haven't learned all the ins and outs of the new xml tools, but I know it's a pretty rich feature set....

  • That is an option that I have thought about, I was hoping that there was another way.

  • it is absolutely valid to cast the text column as xml

    select x.vakue('Xpath Expression', 'datatype') extractedXmlData

    from (

    select cast( txtcol as xml) x from table

    ) data


    * Noel

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply