declare @t table(a int,b varchar(10))
insert into @t select 1,'a'
union all select 2,'b'
union all select 3,'c'
union all select 4,'d'
union all select 5,'e'
declare @a table(c int,d varchar(10))
insert into @a select 6,'f'
union all select 7,'g'
union all select 8,'h'
union all select 9,'i'
union all select 10,'j'
select [id]=identity(int,1,1),* into # from @t
select [id]=identity(int,1,1),* into #1 from @a
select a.a,a.b,b.c,b.d from # a,#1 b where a.id=b.id