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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:37:07+00:00 2026-05-21T23:37:07+00:00

I am trying to convert columns into rows using cursors. I know people say

  • 0

I am trying to convert columns into rows using cursors. I know people say cursors are the right thing to do. I know we can use pivot to achieve this. But the problem is that client needs it as cursors with a for loop. Not really sure as to why they need it that way but looks like its easier for them to understand the code.

Table A

ID  FieldA   FieldB  FieldC 
 1   abc      123     xyz

This needs to be converted to

ID  Field0
 1   abc
 1   123
 1   xyz

Any pointers on how to achieve it could be helpful

Thanks

Prady

  • 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-21T23:37:08+00:00Added an answer on May 21, 2026 at 11:37 pm

    Why not simply:

    select ID, FieldA as Field0 from TableA
    union all
    select ID, FieldB from TableA
    union all
    select ID, FieldC from TableA
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert an XML file into the markup used by dokuwiki, using
I am trying to convert the following SQL into Subsonic syntax using the SqlQuery
I am trying to convert the following code into python: Columns(C:C).Select Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual
I'm trying to convert the output of vmstat into a CSV file using Python,
I've been trying to convert SVG images to PNG using C#, without having to
I'm trying to convert some code that worked great in VB, but I can't
I am trying to convert an ASP.NET website into a web application project. The
I am trying to convert an int into three bytes representing that int (big
I'm trying to convert an incoming sting of 1s and 0s from stdin into
I am trying to convert an access datetime field to a mysdl format, using

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.