Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
<pre>Hi Team,

please find the below table format. I need the output for the below format. I'm trying to retrieve output format but only one column able to bind. I'm working in Sql server 2008 R2. I'm working last 2 days but i can't to bind it.I need the without using pivot and unpivot function.


Table:
======
<pre>	AAA	   AA+	    AA	         AA-
A	6.05	   7.15	    9.5	         8.5
B	3.02	   4.58	    6.25	 7.25
C	2.25	   1.02	    0	         6
		
Output:
=======		
	No	A	B	C
	AAA	6.05	3.02	2.25
	AA+	4.05	3.04	1.02
	AA	3.02	4.05	0
	AA-	2.03	3.01	6


What I have tried:

<pre>Hi Team,

please find the below table format. I need the output for the below format. I'm trying to retrieve output format but only one column able to bind. I'm working in Sql server 2008 R2. I'm working last 2 days but i can't to bind it.I need the without using pivot and unpivot function.


Table:
======
<pre>	AAA	   AA+	    AA	         AA-
A	6.05	   7.15	    9.5	         8.5
B	3.02	   4.58	    6.25	 7.25
C	2.25	   1.02	    0	         6
		
Output:
=======		
	No	A	B	C
	AAA	6.05	3.02	2.25
	AA+	4.05	3.04	1.02
	AA	3.02	4.05	0
	AA-	2.03	3.01	6
Posted
Updated 27-Mar-18 1:32am
Comments
OriginalGriff 27-Mar-18 7:09am    
Repost: Deleted.
Stop posting the same question over and over again: the solution is not going to change, but you will get flagged as a troll and kicked off the site...
OriginalGriff 27-Mar-18 8:38am    
I thought I deleted this?

Ho hum - it has an answer, so I'll leave it.
He just doesn't want to learn how to use PIVOT, I think...
IsaiSelvan 27-Mar-18 8:39am    
yes rt. Yesterday i'm forgot to add a one more column in this post so that, i'm added today please help me. this is very urgent.
Richard Deeming 27-Mar-18 8:43am    
1) If you want to update your question, click the green "Improve question" link and edit your question. DO NOT post your update as a new question!

2) It's not "urgent" for anyone here. Adding "it's urgent" won't make us answer your question any quicker; it will just tell us that your time management skills are seriously lacking.

1 solution

Hi,
This article might help you. Row to Column Without Using Pivot
 
Share this answer
 
Comments
IsaiSelvan 27-Mar-18 8:13am    
thanks for you reply. I using sql 2008 pivot functionality not support in 2008. max also not possible to bind it. Kindly help me.
OriginalGriff 27-Mar-18 8:42am    
"I using sql 2008 pivot functionality not support in 2008"
PIVOT was introduced at SQL 2005, and most certainly is in 2008:

https://technet.microsoft.com/en-us/library/ms177410(v=sql.105).aspx

Stop trying to get others to do your work for you and start learning ... it's a lot quicker.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900