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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:54:41+00:00 2026-05-22T22:54:41+00:00

I have written an interface to interact with the CubeIQ BlackBox (www.magiclogic.com) and I

  • 0

I have written an interface to interact with the CubeIQ BlackBox (www.magiclogic.com) and I have an SQL Server 2005 database table where I store some regular text fields, dates, and two pieces of XML in columns that have an XML data type.

There are a few values I want to pick out of the XML, and I cannot figure out how to query the XML, or the attributes of nodes within that XML.

Here is the type of query I want to do:

 SELECT 
    [regular_table_field1],
    [regular_table_field2],
    [opt_resposne_xml].rootnode.wrapper.child@attr('someattribute') AS 'someattribute',
    [opt_resposne_xml].rootnode.wrapper.child@attr('someattribute2') AS 'someattribute2'
 FROM [optimizations] WHERE [opt_concept_id] = '1234'
  • 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-22T22:54:42+00:00Added an answer on May 22, 2026 at 10:54 pm

    Not knowing what your XML looks like, here’s a general purpose piece of code to give you an idea of what it would look like:

     SELECT 
        [regular_table_field1],
        [regular_table_field2],
        [opt_resposne_xml].value('(/rootnode/wrapper/child/@someattribute)[1]', 'int') AS 'someattribute',
        [opt_resposne_xml].value('(/rootnode/wrapper/child/@someattribute2)[1]', 'varchar(50)') AS 'someattribute2'
     FROM 
         [optimizations] 
     WHERE 
         [opt_concept_id] = '1234'
    

    If you need to “reach into” the XML column and grab out a single value (from an XML element or attribute), you basically need to define the XPath to that location of where the information you’re interested in is located, and you need to convert that to a given SQL Server datatype.

    If you need to have a single relational row cross joined against a number of elements from a single XML field, you might need other approaches (CROSS APPLY).

    Also: you might need to pay attention to XML namespaces that are involved – a common pitfall when trying to parse XML inside SQL Server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a server I've written in C#. I need to interface with it
I have a third-party (Win32) DLL, written in C, that exposes the following interface:
I have written an AIR Application that downloads videos and documents from a server.
We have several applications that are installed in several departments that interact with database
I have written a simple database driven app in C# which uses a 2
I have previously written user interfaces using .NET and Windows Forms. I'm about to
I have written a set of classes and interfaces that are implemented in Moose
The title basically spells it out. What interfaces have you written that makes you
I have written some code in my VB.NET application to send an HTML e-mail
I have written a site in Prototype but want to switch to jQuery. Any

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.