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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:57:14+00:00 2026-06-11T00:57:14+00:00

I have a column in table which contains XML text, but it is not

  • 0

I have a column in table which contains XML text, but it is not XML type and its type should not be changed.

I have write the following SQL query to get some information from its

DECLARE @TempXML XML=(SELECT TOP 1 XMLColumn FROM TableOne)

SELECT  T.c.query('.').value('(/question/@id)[1]','BIGINT') AS [QuestionID]
       ,T.c.query('.').value('(/question/@comment)[1]','NVARCHAR(100)') AS [Comment]
       ,T.c.query('.').value('(/question/answer/@pos)[1]','TINYINT') AS [AnswerPosition]
FROM   @TempXML.nodes('/submission/question') T(c)

The problem I have net is that I have to create a view in which for each row the query above will be executed, but I am not able to concatenated the query and the xml conversion.

I have try to create CTE in which to do the conversion but then met some difficulties
in implementing my query.

WITH CTEview(CurrentXML) AS 
(
    SELECT CAST(XMLColumn AS XML) AS [CurrentXML]
    FROM TableOne
)
--My SQL goes here
  • 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-11T00:57:15+00:00Added an answer on June 11, 2026 at 12:57 am

    Using “Cross Apply” to the XML columns from the CTE solve the issue.

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

Sidebar

Related Questions

I have a Clob column in a table which contains xml data. I try
Database: Sql Server I have table column named page_text which contains following value I
I have a column in Datablase Table, Suppose its Observation which contains three types
I have a table which contains a column discussion_duration where I am storing certain
I have a oracle table A which contains a column A.a which used to
we have a table in an Oracle Database which contains a column with the
i have a large mysql database table in which one column contains values ranging
I have a table in Oracle where one of the column contains UserIds which
I have a table where last column contains action buttons which opens another section
i have a table Students which contains the following colums: Id,FirstName,LastName,Adress . The colum

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.