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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:50:18+00:00 2026-06-05T23:50:18+00:00

I am trying to extract values from an XML column. Unfortunately, whatever combination I

  • 0

I am trying to extract values from an XML column. Unfortunately, whatever combination I try, I can’t get any meaningfull result out of it.

A test script with data can be found here

Related questions that did not turn the light on for me

  • Getting values from XML type field
  • XML query() works, value() requires singleton
  • Getting rowsets from XQuery and SQL Server 2005

Example of the contents of one item

<Dictionary xmlns="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:mtbwa="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:TypeArguments="x:String, x:Object">
  <mtbwa:BuildSettings x:Key="BuildSettings" ProjectsToBuild="$/Projects/BpABA/Dev/V6/DUnit/FrameworkTests.dproj">
    <mtbwa:BuildSettings.PlatformConfigurations>
      <mtbwa:PlatformConfigurationList Capacity="1">
        <mtbwa:PlatformConfiguration Configuration="Debug" Platform="Win32" />
      </mtbwa:PlatformConfigurationList>
    </mtbwa:BuildSettings.PlatformConfigurations>
  </mtbwa:BuildSettings>
  <mtbwa:SourceAndSymbolServerSettings SymbolStorePath="{x:Null}" x:Key="SourceAndSymbolServerSettings" />
  <mtbwa:AgentSettings x:Key="AgentSettings" MaxExecutionTime="01:00:00" MaxWaitTime="04:00:00" Tags="Delphi 5" />
  <x:Boolean x:Key="CreateWorkItem">False</x:Boolean>
  <x:Boolean x:Key="PerformTestImpactAnalysis">False</x:Boolean>
</Dictionary>

Latest attempt

;WITH XMLNAMESPACES('http://schemas.microsoft.com/winfx/2006/xaml' AS mtbwa)
, q AS (
  SELECT  CAST(bd.ProcessParameters AS XML) p
  FROM    dbo.tbl_BuildDefinition bd     
) 
SELECT  X.Doc.value('mtbwa:BuildSettings[0]', 'VARCHAR(50)') AS 'Test'
FROM    q CROSS APPLY p.nodes('/mtbwa:Dictionary') AS X(Doc)

Background

The column ProcessParameters is part of the TFS build system in the tbl_BuildDefinition table.
The complete DDL is as follows

USE [Tfs_ProjectCollection]
GO

/****** Object:  Table [dbo].[tbl_BuildDefinition]    Script Date: 06/19/2012 16:28:56 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[tbl_BuildDefinition](
    [DefinitionId] [int] IDENTITY(1,1) NOT NULL,
    [GroupId] [int] NOT NULL,
    [DefinitionName] [nvarchar](260) NOT NULL,
    [ControllerId] [int] NOT NULL,
    [DropLocation] [nvarchar](260) NULL,
    [ContinuousIntegrationType] [tinyint] NOT NULL,
    [ContinuousIntegrationQuietPeriod] [int] NOT NULL,
    [LastBuildUri] [nvarchar](64) NULL,
    [LastGoodBuildUri] [nvarchar](64) NULL,
    [LastGoodBuildLabel] [nvarchar](326) NULL,
    [Enabled] [bit] NOT NULL,
    [Description] [nvarchar](2048) NULL,
    [LastSystemQueueId] [int] NULL,
    [LastSystemBuildStartTime] [datetime] NULL,
    [ProcessTemplateId] [int] NOT NULL,
    [ProcessParameters] [nvarchar](max) NULL,
    [ScheduleJobId] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_tbl_BuildDefinition] PRIMARY KEY CLUSTERED 
(
    [GroupId] ASC,
    [DefinitionName] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[tbl_BuildDefinition] ADD  DEFAULT (newid()) FOR [ScheduleJobId]
GO
  • 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-06-05T23:50:21+00:00Added an answer on June 5, 2026 at 11:50 pm

    I think you have a wrong namespace defined for your mbtwa prefix in your XML/XQuery text, and you need to use 1-based indexing to get at the data when using the .value() function (not 0-based like commonly used).

    So try this:

    ;WITH XMLNAMESPACES('clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow' AS mtbwa, 
                        DEFAULT 'clr-namespace:System.Collections.Generic;assembly=mscorlib')
    , q AS (
      SELECT CAST(bd.ProcessParameters AS XML) p
      FROM dbo.tbl_BuildDefinition bd     
      WHERE DefinitionId = 1
    ) 
    SELECT  
        X.Doc.query('mtbwa:BuildSettings') AS 'Node',
        X.Doc.value('(mtbwa:BuildSettings/@ProjectsToBuild)[1]', 'VARCHAR(50)') AS 'ProjectsToBuild'
    FROM
        q 
    CROSS APPLY 
        p.nodes('/Dictionary') AS X(Doc)
    

    This should give you the whole <mtbwa:BuildSettings> node as XML (using the .query() function), as well as the value of the single attribute ProjectsToBuild ($/Projects/BpABA/Dev/V6/DUnit/FrameworkTests.dproj) of that node.

    enter image description here

    If you want a whole node (as XML), then you need to use .query('xpath') – the .value() function can get you the inner text of a node (if present), or the value of a single attribute.

    Does that help at all?

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

Sidebar

Related Questions

I'm trying to extract the StateLongName and StateShortName values from the xml below. I
I'm trying to extract values from xml using jQuery in a cross-browser compatible fashion.
i have tried several methods of trying to extract values from an XML file
I am trying to extract values from an XML file using linq to create
I am trying to extract values from a string, I have tried to get
I am trying to extract data from a xml file, get rid of the
I am trying to extract certain values from an xml document. In the example
I am trying to extract a value from an xml element, located in an
I'm trying to use SSIS to extract XML representation of a query result set
hi i'm trying to extract values from this tagged file here is the file

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.