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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Statement Append Tables

Author  Topic 

andrew.vint
Starting Member

2 Posts

Posted - 2006-05-15 : 12:49:29
Hi,

I am going through the process of upsizing an old Access Database to an SQL database. However as with these things i have a few queries that dont work.

What i am trying to do is copy the contents of one table and append it to the end of another. I try to use the following SQL statement but it does not work stating the table (destination) already exists.

INSERT * INTO TableB FROM TableA

I am sure this is simple to those that know, but i would really appreciate any help on this.

Thanks in advance

Andrew Vint

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2006-05-15 : 12:58:22
Here's a working example for you...

declare @TableA table (a int, b int)
insert @TableA
select 1, 2

declare @TableB table (a int, b int)
insert @TableB
select 3, 4
union all select 5, 6

insert into @TableA select a, b from @TableB

select * from @TableA


Ryan Randall
www.monsoonmalabar.com London-based IT consultancy

Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page
   

- Advertisement -