Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7052839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:25:55+00:00 2026-05-28T03:25:55+00:00

I have some html content in a SQL Server column, I want to read

  • 0

I have some html content in a SQL Server column, I want to read the content from the html.

For example:

<ektdesignns_choices ektdesignns_nodetype="element" title="How many gigs do you play each month?" ektdesignns_caption="How many gigs do you play each month?" name="ektpoll1303074024421" ektdesignns_name="ektpoll1303074024421" id="ektpoll1303074024421">
  <ol contenteditable="false" onkeypress="design_validate_choice(1, -1, this, 'Options are required.')" onclick="design_validate_choice(1, -1, this, 'Options are required.')" onblur="design_validate_choice(1, -1, this, 'Options are required.')" ektdesignns_validation="choice-req" ektdesignns_maxoccurs="1" ektdesignns_minoccurs="1" unselectable="on" title="How many gigs do you play each month?" class="design_list_vertical">
    <li>
      <input type="radio" ektdesignns_nodetype="item" name="ektpoll1303074024421" value="1 or fewer_1" title="1 or fewer" id="ID2504263" />
      <label contenteditable="true" unselectable="off" for="ID2504263">1 or fewer</label>
    </li>
    <li>
       <input type="radio" ektdesignns_nodetype="item" name="ektpoll1303074024421" value="2-4_2" title="2-4" id="ID5115606" />
       <label contenteditable="true" unselectable="off" for="ID5115606">2-4</label>
    </li>
    <li>
        <input type="radio" ektdesignns_nodetype="item" name="ektpoll1303074024421" value="5-7_3" title="5-7" id="ID477116" />
        <label contenteditable="true" unselectable="off" for="ID477116">5-7</label>
    </li>
    <li>
        <input type="radio" ektdesignns_nodetype="item" name="ektpoll1303074024421" value="8 or more_4" title="8 or more" id="ID5515606" />
        <label contenteditable="true" unselectable="off" for="ID5515606">8 or more</label>
    </li>
  </ol>
</ektdesignns_choices><input type="submit" value="Vote" />

I want read all the labels in this html. Anyone have any idea, how shall I go about it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:25:55+00:00Added an answer on May 28, 2026 at 3:25 am

    If your HTML is indeed XHTML compliant, and if you have the HTML stored in a XML column in your SQL Server table, then you could retrieve your labels from it in T-SQL using XQuery:

    DECLARE @HtmlTbl TABLE (ID INT IDENTITY, Html XML)
    
    INSERT INTO @HtmlTbl(Html) VALUES('<ektdesignns_choices ektdesignns_nodetype="element" title="How many gigs do you play each month?" ektdesignns_caption="How many gigs do you play each month?" name="ektpoll1303074024421" ektdesignns_name="ektpoll1303074024421" id="ektpoll1303074024421">
      <ol contenteditable="false" onkeypress="design_validate_choice(1, -1, this, ''Options are required.'')" onclick="design_validate_choice(1, -1, this, ''Options are required.'')" onblur="design_validate_choice(1, -1, this, ''Options are required.'')" ektdesignns_validation="choice-req" ektdesignns_maxoccurs="1" ektdesignns_minoccurs="1" unselectable="on" title="How many gigs do you play each month?" class="design_list_vertical">
        <li>
          <input type="radio" ektdesignns_nodetype="item" name="ektpoll1303074024421" value="1 or fewer_1" title="1 or fewer" id="ID2504263" />
          <label contenteditable="true" unselectable="off" for="ID2504263">1 or fewer</label>
        </li>
        <li>
           <input type="radio" ektdesignns_nodetype="item" name="ektpoll1303074024421" value="2-4_2" title="2-4" id="ID5115606" />
           <label contenteditable="true" unselectable="off" for="ID5115606">2-4</label>
        </li>
        <li>
            <input type="radio" ektdesignns_nodetype="item" name="ektpoll1303074024421" value="5-7_3" title="5-7" id="ID477116" />
            <label contenteditable="true" unselectable="off" for="ID477116">5-7</label>
        </li>
        <li>
            <input type="radio" ektdesignns_nodetype="item" name="ektpoll1303074024421" value="8 or more_4" title="8 or more" id="ID5515606" />
            <label contenteditable="true" unselectable="off" for="ID5515606">8 or more</label>
        </li>
      </ol></ektdesignns_choices><input type="submit" value="Vote" />')
    

    This will retrieve all <label> elements from your (X)Html as a single XML string:

    SELECT
        Html.query('//label')
    FROM @HtmlTbl 
    WHERE ID = 1
    

    Output:

    <label contenteditable="true" unselectable="off" for="ID2504263">1 or fewer</label>
    <label contenteditable="true" unselectable="off" for="ID5115606">2-4</label>
    <label contenteditable="true" unselectable="off" for="ID477116">5-7</label>
    <label contenteditable="true" unselectable="off" for="ID5515606">8 or more</label>
    

    Or this will select all the contents of the <label> tags, one per row:

    SELECT
        C.value('(.)[1]', 'varchar(1000)')
    FROM @HtmlTbl 
    CROSS APPLY Html.nodes('//label') AS T(C)
    WHERE ID = 1
    

    Output:

    1 or fewer
    2-4
    5-7
    8 or more
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some html content who have some classes and inline stylesheet. i want
I have seen some mails which has HTML content embedded in them. The content
I have some content sliding here. http://www.smallsharptools.com/downloads/jQuery/Slider/slider.html The HTML structure is simple. There is
I have some html files that I want to convert to text. I have
I have a table with 6 columns containing HTML content with some markups in
I have some html content stored in a database field. I would like trusted
I have some static html content (included on a dynamically generated page) that I
Say I have some HTML elements: <div>First</div> <div>Second</div> <div>Third</div> Whose content I select via
I have some images (png's and jpg's mostly) that I'm storing in SQL Server
I have some HTML content (including formatting tags such as strong , images etc).In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.