Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Is it possible to query any text on xmldata of sqlserver 2005 table?

Is it possible to query any text on xmldata of sqlserver 2005 table?

Scheduled Pinned Locked Moved C#
databasesql-serversysadminquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nicolus
    wrote on last edited by
    #1

    I am querying like below SELECT XMLData.query('"title"') FROM XMLTable on an sql server database's xmlTable's XMLData of xmltype field. But it alway returning the string "title" for all the records in the table. Is it not possible to query like the above ? Please suggest something.

    B 1 Reply Last reply
    0
    • N nicolus

      I am querying like below SELECT XMLData.query('"title"') FROM XMLTable on an sql server database's xmlTable's XMLData of xmltype field. But it alway returning the string "title" for all the records in the table. Is it not possible to query like the above ? Please suggest something.

      B Offline
      B Offline
      buchstaben
      wrote on last edited by
      #2

      i've never used sql server xml functionality, but it looks like you're using wrong syntax. execution the xpath "'title'" will always return "title", so you may need to modify your xpath expression. what's a sample content of your xmltype field?

      N 1 Reply Last reply
      0
      • B buchstaben

        i've never used sql server xml functionality, but it looks like you're using wrong syntax. execution the xpath "'title'" will always return "title", so you may need to modify your xpath expression. what's a sample content of your xmltype field?

        N Offline
        N Offline
        nicolus
        wrote on last edited by
        #3

        Actually i want to search the string "title" at any location through out the complete xml data. what is the way to frame the query? Plese help.

        B 1 Reply Last reply
        0
        • N nicolus

          Actually i want to search the string "title" at any location through out the complete xml data. what is the way to frame the query? Plese help.

          B Offline
          B Offline
          buchstaben
          wrote on last edited by
          #4

          so there is some xml data with 0, 1 or more occurances of "title" anywhere? okay..but what do you expect your query to return?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups