Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on How to convert rows into columns in sql server 2000 within the SQL Server forums, part of the Databases category; Hi, suppose the input is, name1 id1 id2 id3 id4 name2 id1 id2 id3 id4 I want the output as in the database, name1 id1 name1 id2 name1 id3 name1 ...
|
|||||||
| SQL Server SQL Server is a Database Management System(DBMS) by Microsoft |
![]() |
| LinkBack | Thread Tools | Display Modes |
|
|||
|
How to convert rows into columns in sql server 2000
Hi,
suppose the input is, name1 id1 id2 id3 id4 name2 id1 id2 id3 id4 I want the output as in the database, name1 id1 name1 id2 name1 id3 name1 id4 name2 id1 name2 id2 name2 id3 name2 id4 Please help me out on solving this in sql server 2000. |
| Sponsored Links |
|
|||
|
Re: How to convert rows into columns in sql server 2000
Quote:
The member name is "kkknnn" . Last edited by CSOOR; 07-27-2009 at 05:00 PM. |
|
|||
|
Re: How to convert rows into columns in sql server 2000
SELECT <non-pivoted column>,
[first pivoted column] AS <column name>, [second pivoted column] AS <column name>, ... [last pivoted column] AS <column name> FROM (<SELECT query that produces the data>) AS <alias for the source query> PIVOT ( <aggregation function>(<column being aggregated>) FOR [<column that contains the values that will become column headers>] IN ( [first pivoted column], [second pivoted column], ... [last pivoted column]) ) AS <alias for the pivot table> <optional ORDER BY clause>; |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Identify Rows columns in datagrid control | kanta | QTP | 8 | 07-31-2008 05:11 PM |
| How can we write the columns set as rows set? | nageshkota | SQL Server | 4 | 04-29-2008 01:16 AM |
| Rows to columns and vice-versa | tanya_j | Data Warehousing | 1 | 03-25-2008 06:49 AM |
| How to convert rows into columns in Teradata | rashnyo | Data Warehousing | 0 | 07-12-2007 01:52 AM |
| How do I transpose Rows into Columns? | Anasuya1031 | SQL | 2 | 07-09-2007 05:37 AM |