|
Posted by M A Srinivas on 06/29/07 12:27
On Jun 29, 3:09 pm, Yas <yas...@gmail.com> wrote:
> Hello,
>
> I was wondering if anyone can help me figure something out.
> Is it possible to do a querey in MS SQL server and have the results
> returned so that each result in each row is preceeded by the column
> name?
>
> eg. instead of usual output -> colName1, colValue1,
> colName2,colValue2,colName3,colValue3 ?
>
> Also I would like to only have this for certain columns ie in the
> above example only for columns 2 and 3
>
> Thank you! :-)
>
> Yas
Not sure what you are actually looking at
create table #temp (col1 int, col2 int , col3 varchar(10))
insert into #temp values (1,10,'abcd')
insert into #temp values (2,20,'efgh')
select col1, ' col2:'+cast(col2 as varchar(10))+ '-col3:'+col3 as
col23
from #temp
drop table #temp
[Back to original message]
|