sql server - Two columns into one using alternate rows -


i have table 2 columns this:

a   1 b   2 c   3 d   4 e   5  

etc.

i want them 1 column, each column's data in alternate rows of new column this:

a 1 b 2 c 3 d 4 e 5 

etc.

i use union all here unpivot alternative:

create table #table1(letter varchar(10),id varchar(10))  insert #table1(letter ,id ) select 'a',1 union select 'b',2 union select 'c',3 union select 'd',4 union select 'e',5    select [value] #table1 unpivot (     [value] [column] in ([id], [letter]) ) unpvt   drop table #table1; 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -