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

  • Home
  • SEARCH
  • 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 6353315
In Process

The Archive Base Latest Questions

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

I have this table declare @temp_xml table ( question_id int, question_xml xml ) insert

  • 0

I have this table

declare  @temp_xml table
(
    question_id int,
    question_xml xml
)

insert into @temp_xml(question_id, question_xml)
values(51, '<qst qodm="Horizontal" oprm="New Line" oph="25" opw="200" stext=""   filepath="" peqid="-1" peaid="-1" pipeqtype="1" rad="False"><cps><qvs qvid="V1" qvt="Required" qvem="Please choose at least one answer." /><qvs qvid="V15" qvt="UK Phone Number " qvem="Is not a correct phone format." /></cps><branch><![CDATA[]]></branch></qst>'
      ),
      (52,
   '<qst qodm="Horizontal" oprm="New Line" oph="25" opw="200" stext="" filepath="" peqid="-1" peaid="-1" pipeqtype="1" rad="False"><cps><qvs qvid="V1" qvt="Required" qvem="Please choose at least one answer." /><qvs qvid="V5" qvt="US/Canada  Phone Number " qvem="Is not a correct phone format." /></cps><branch><![CDATA[]]></branch></qst>'
      )

select * from @temp_xml

Now I want to show like this .

   Question_id  qvt                       qvem
   51,          Required,                 Please choose at least one answer.
   51,          UK Phone Number,          Is not a correct phone format.
   52,          Required,                 Please choose at least one answer.
   52,          US/Canada  Phone Number,  Is not a correct phone format.

any one can help me out ?

Thanks.

  • 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-24T22:23:22+00:00Added an answer on May 24, 2026 at 10:23 pm

    I would avoid the old openxml API altogether and use the new XQuery style in SQL Server 2005 and newer.

    In your case, this would be something like:

    DECLARE @Temp_XML TABLE (question_id int, question_xml xml)
    
    insert into @Temp_XML(question_id, question_xml)
    values(51, 
    '<qst qodm="Horizontal" oprm="New Line" oph="25" opw="200" stext="" filepath="" peqid="-1" peaid="-1" pipeqtype="1" rad="False">
        <cps>
            <qvs qvid="V1" qvt="Required" qvem="Please choose at least one answer." />
            <qvs qvid="V15" qvt="UK Phone Number " qvem="Is not a correct phone format." />
        </cps>
        <branch><![CDATA[]]></branch>
    </qst>'),
          (52,
    '<qst qodm="Horizontal" oprm="New Line" oph="25" opw="200" stext="" filepath="" peqid="-1" peaid="-1" pipeqtype="1" rad="False">
        <cps>
            <qvs qvid="V1" qvt="Required" qvem="Please choose at least one answer." />
            <qvs qvid="V5" qvt="US/Canada  Phone Number " qvem="Is not a correct phone format." />
        </cps>
        <branch><![CDATA[]]></branch>
    </qst>')
    
    SELECT
        question_id,
        CPS.QVS.value('(@qvid)[1]', 'varchar(50)') AS 'QVID',
        CPS.QVS.value('(@qvt)[1]', 'varchar(50)') AS 'QuestionValidationType',
        CPS.QVS.value('(@qvem)[1]', 'varchar(50)') AS 'QuestionValidationMessage'
    FROM  
        @Temp_xml
    CROSS APPLY
        question_xml.nodes('/qst/cps/qvs') AS CPS(QVS)
    

    This produces an output like this (I included the “QVID” column, just to show what really gets selected):

    question_id QVID  QuestionValidationType     QuestionValidationMessage
    51           V1     Required                 Please choose at least one answer.
    51           V15    UK Phone Number          Is not a correct phone format.
    52           V1     Required                 Please choose at least one answer.
    52           V5     US/Canada Phone Number   Is not a correct phone format.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this table CREATE TABLE `codes` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
I have this table: CREATE TABLE `test` ( `ID` int(11) NOT NULL auto_increment, `text`
I have this table: CREATE TABLE `point` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `siteid`
I have a test table like this CREATE TABLE #temp ( rid INT IDENTITY
Very simplified, I have two tables Source and Target. declare @Source table (SourceID int
I have this table variable declaration followed by a query: DECLARE @CurrentItems TABLE (
I have this table in an Oracle DB which has a primary key defined
I have this table CREATE TABLE [dbo].[friend_blocked_list]( [subdomain] [varchar](50) NOT NULL, [un] [nvarchar](50) NOT
i have this table in UTF8 (collation is utf8_bin in case it matters). I
I have this table: fourn_category (id , sub) I am using this code to

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.