This is the most basic, for a fixed
number of rows. But at least it's linear.
declare @mytab table (id int, name varchar(20), age int)
insert @mytab
select 1,'Anand',27
insert @mytab
select 2,'Joe',30
insert @mytab
select 3,'Mac',29
select top 1 a.id, a.name, a.age, b.id, b.name, b.age, c.id, c.name, c.age
from @mytab a, @mytab b, @mytab c
where a.id <> b.id and
a.id <> c.id and
b.id <> c.id
order by a.id
If your row # is variable then a loop to create the linear row is required.
-------------- Original message --------------
> Hi Gurus,
> need an urgent help.
> I have got a table Called "Nominee"
> The values are like this
>
> Id Name Age
> 1 Anand 27
> 2 Joe 30
> 3 Mac 29
>
> I want the transpose it and the data should look like
>
> 1 Anand 27 2 Joe 30 3 Mac 29
>
>
> Any help would be appriciated..
>
> Regards
> Ananda Kumar
>
>
MS Sql Server LazyDBA home page