473,511 Members | 15,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

transpose columns

2 New Member
Hello please i have some problem.
how can i tranpose ? with SQlserver2005 ,or sql ,or script or,T-SQL

for example
column(f,a1,a2,a3)
f a1 a2 a3
1 1 4 6
2 4 6 5
......
i would like to transform like this:
columns (f question ,value)
f question value
1 a1 1
1 a2 4
1 a3 6

.......
please i need help.
thanks
Jun 24 '07 #1
3 1607
Purple
404 Recognized Expert Contributor
Hi gozo74 and welcome to TSDN !!

Can you clarify if you are asking how to rename the columns on a table or if your question is how to generate output from the table in a specific format

Regards Purple
Jun 24 '07 #2
gozo74
2 New Member
Hi gozo74 and welcome to TSDN !!

Can you clarify if you are asking how to rename the columns on a table or if your question is how to generate output from the table in a specific format

Regards Purple
thanks for u answer.
in Excel it,s easy to transpose some table. but i will like to do the same thing in sqlserver.

i have for example this table:
ID II_1 II_2 II_3 II_4
1 1 2 3 4
2 1 1 1 1
3 1 1 2 2
4 1 2 2 3

i would like to have

ID test value
1 II_1 1
1 II_2 2
1 II_3 3
1 II_4 4
thanks
Jun 24 '07 #3
Purple
404 Recognized Expert Contributor
Hi gozo74,

how many test cases are there ? Just 1 to 4 or 1 to n ? Do you actually want to put the converted data into a table or just output it as a result set ?

Purple
Jun 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
12036
by: sangeetha | last post by:
Hi, i need to transpose a nx1 matrix to 1xn matrix inorder to multiply with nxn matrix in c language ... can anyone help in this coding ..the nx1 matrix is pi the data type is double *pi..this is...
1
18423
by: Chris Smith | last post by:
Experience Posters, Sorry if this is not the right group to post this question. He is my issue; Is there a way without the use of 3rd party controls, to transpose the rows of a datatable to...
7
3586
by: Leszek Gruszka | last post by:
I wrote an aplication that write something into tableA in sql2000. I want to write the same, but transposed into tableB. Someone can help me? Any example? *** Sent via Developersdex...
8
1900
by: Leszek Gruszka | last post by:
I wrote code, that fill TableA with records by executenonquery. But i want to have second TableB, that will be transposed TableA. My code: Public Sub SQL_Wpis() Dim sSQL As String sSQL =...
5
1980
by: hummer | last post by:
In an Access query, I am trying to do the following: I have this: Account # Issue Problem ------------------------------------------------------------------- 1 a...
0
7249
by: shantanu | last post by:
I am trying to convert a macro code to c# that will copy the values of a column and paste to anather through paste special. Everything is working fine but the transpose meathod to paste the column...
1
6480
by: lenygold via DBMonster.com | last post by:
Chris Eaton created a SP to to transpose rows to columns : Here is an example of a rowtocol stored proc that takes a SQL statement as the first paramter, a delimiter as the second parameter and the...
0
1040
by: east7 | last post by:
Hi all, I have following table with 2 columns ID | TIME ========= A 07:01 A 12:05 A 12:59 A 15:09
5
12562
by: jenniferhelen | last post by:
I have been searching threads for a while and found the instructions listed below many times, however when I get to step 6 and select to save, I always receive the following error, "The information...
12
19805
by: jenniferhelen | last post by:
I am working with a query that has 6 columns and 101 rows; I would like to transpose the rows and columns. I have tried using a crosstab query but Access limits the row "fields" to 3 and this was...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7371
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5077
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.