Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sweet_777
Starting Member
16 Posts |
Posted - 2010-10-21 : 08:25:44
|
| hI ALL,MY SQL QUERY IS LIKE THIS:SELECT EMPID,EMPNAME,SAL FROM EMP0/P:EMPID,EMPNAME,SAL1 A 1000,2 B 2000,3 C 3000BUT MY REQUIREMENT IS :COLUMN(SOME ALIAS NAME )1A10002B20003C3000HOW TO DO HOW TO DEVIDE SINGLE 3 COLUMNS INTO ROWS.Thanks & RegardsSweet_77 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2010-10-21 : 09:05:38
|
I'd do this in the UI. columns don't have the same datatype so you'd have to cast them all to strings to do it. elsasoft.org |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-10-23 : 02:12:38
|
| also do you have any other column to determine the order of retrieval?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-10-23 : 02:52:17
|
| [code]declare @tbl table(nm varchar(10),id int)insert into @tblselect 'a',1 union select 'b',2select col from(select nm,CONVERT(varchar(10),id)id from @tbl)uunpivot (col for columns in(nm,id))v[/code]PBUH |
 |
|
|
|
|
|