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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Rows to Columns Transformation

Author  Topic 

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2012-03-21 : 06:46:53
I have data in my table like this

Val_NM Col_NM RID
ABC FILE_NM 1
.sql FILE_EXT 1
4162 FILE_SZ 1
DEF FILE_NM 2
.doc FILE_EXT 2
2278 FILE_SZ 2
XYZ FILE_NM 3
.XLS FILE_EXT 3
2320 FILE_SZ 3

I Like to have output like this.
FILE_NM FILE_EXT FILE_SZ
ABC .sql 4162
DEF .doc 2278
XYZ .XLS 2320

Is there anyway to get desired output. I tried something and used correlated sub-queries and get output but it is very costly operation.


------------------------------------------------
The answer is always no till than you don't ask.

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2012-03-21 : 06:54:51
Sorry get it with PIVOT also. Thanks

------------------------------------------------
The answer is always no till than you don't ask.
Go to Top of Page
   

- Advertisement -