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 3362472
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:16:42+00:00 2026-05-18T03:16:42+00:00

The stock ELMAH_Error table uses an nText field to store an Error entry. I

  • 0

The stock ELMAH_Error table uses an nText field to store an Error entry. I found that by adding a field of type XML; then adding this new field to the INSERT statement of the SPROC that populates the field; i could make better use of ELMAH’s output.

Now I’d like to learn how to query specific element values within that XML field. The document is structured as:

<error [...]>
  <serverVariables>
    <item name="ALL_HTTP">
      <value string="..." />
    </item>
    <item name="ALL_RAW">
      <value string="..." />
    </item>
    .
    .
    .
  </serverVariables>
</error>

I need to be able to query the value of specific items beneath .

So I’m looking at an example from the 15seconds.com article:

SELECT MyXml.value('(/root/product[@id="304"]/name)[1]', 'nvarchar(30)')

and am trying to maps those values to my field’s structure – but can’t. E.g.

select top 10 RealXML.value('(/error/serverVariables[@id="REMOTE_HOST"]/name)[0]', 'nvarchar(30)') 

where REMOTE_HOST is formatted:

<item name="REMOTE_HOST">
  <value string="55.55.55.55" />
</item>

much appreciated

  • 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-18T03:16:43+00:00Added an answer on May 18, 2026 at 3:16 am

    This should work:

    select top 10 RealXML.value('(/error/serverVariables/item[@name="REMOTE_HOST"]/value/@string)[1]', 'nvarchar(30)') 
    

    Tested using the following:

    DECLARE @xml XML  = '
    <error>
      <serverVariables>
        <item name="ALL_HTTP">
          <value string="..." />
        </item>
        <item name="ALL_RAW">
          <value string="..." />
        </item>
    <item name="REMOTE_HOST">
      <value string="55.55.55.55" />
    </item>
      </serverVariables>
    </error>
    '
    SELECT @xml.value('(/error/serverVariables/item[@name="REMOTE_HOST"]/value/@string)[1]','nvarchar(30)') 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the stock svn that comes with OSX is 1.4.4 and I upgraded (through opencollab
Are there any stock images that come with the system that I can use
For example: @Table(name = stock, catalog = mkyong, uniqueConstraints = { @UniqueConstraint(columnNames = STOCK_NAME),
On stock android, what is that thing called when you click a contact's picture
I had built a stock quotes widget but now find that it no longer
I've got a stock Debian Etch system, using Exim4. The domains are mostly local
i've got a stock standard ASP.NET web site, deployed to our development machine (internal
I'm trying to connect my stock standard, default ASP.NET MVC (web) application to the
Is it possible (by using the stock c# TreeView) to have Multiline TreeNodes? Also,
I'm working on a stock exchange information platform and we are thinking in provide

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.