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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:19:05+00:00 2026-06-04T01:19:05+00:00

I have 3 columns in my table X: Id State Type 1 NJ Form1

  • 0

I have 3 columns in my table X:

Id      State       Type
1        NJ         Form1
1        NY         Form 2
1        TX         Form 3

I want to consolidate it to one column in table Y:

Id   FormTypes
1    NJ:Form1
     NY:Form2
     TX: Form3

Is this possible to achieve???

Currently I have worked out so much:

DECLARE @NewLine as char(2) = char(13) + char (10)

UPDATE tableY

SET FormTypes =
(
      select substring(
         (select ':'+ [State] + ':'+ Type+ @NewLine AS 'data()' 
            from tableX  
            for xml path(''))
      ,3, 255)
as "MyList"  )

This is giving me garbage like this:

NJ:Form1'&#x0D'; NY:Form2'&#x0D'; TX:Form3'&#x0D';

The reason for getting it in this form is due to the way it is getting read in multiple files.

  • 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-04T01:19:07+00:00Added an answer on June 4, 2026 at 1:19 am
    SELECT 
         x2.id, 
         STUFF((SELECT char(10)+x1.State+':'+x1.Type FROM tableX x1 WHERE x1.id=x2.id GROUP BY x1.id for xml path(''),TYPE),1,1,'') as stype 
    FROM tableX x2
    GROUP BY x2.id
    

    this will give you tableY form

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

Sidebar

Related Questions

Lets say I have a table with columns such as: ID Name City State
I have a table column where each row has one of three states, and
The table columns have the data type BLOB and CLOB. What are the corresponding
I have this table: create table demo ( key number(10) not null, type varchar2(3)
I have created a MySQL table where one of the columns stores a BLOB
I have a column in my database of data type Geography which I want
I have two columns in my table and the rows are created dynamically. <table
I have 2 Columns in a table. Activities and Average % of Time, For
I have 2 columns in a table and I would like to roughly report
I have 6 columns in a table. I have a select query which selects

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.