How append records from table

EYoung
EYoung used Ask the Experts™
on
How can I append records from one MS SQL table (Table A) into another MS SQL table (TableB)?

Both tables are identical in design but contain different records.  There are 10,000 records in each table so when the combining is done, the resultant table should have exactly 20,000 records.

Each table has 50 fields so I would like to use the asterisk (*) instead of specifing each field in each table.

I am using SQL Server 2000.

I have tried to use the OUTER JOIN command but it causes a cartesian result.

I just want to add 10,000 new records to an existing table.

Thank you for the help
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
SQL Server Data Dude
Most Valuable Expert 2013
Author of the Year 2015
Commented:
INSERT INTO TableB
SELECT * FROM TableA
Jim HornSQL Server Data Dude
Most Valuable Expert 2013
Author of the Year 2015

Commented:
The test script for SQL 2008 R2 is below.

CREATE TABLE test1 (id int, full_name varchar(50))

INSERT INTO test1 (id, full_name)
VALUES (1, 'Jack Black'), (2, 'Joe Green'), (3, 'Jake Brown')

CREATE TABLE test2 (id int, full_name varchar(50))

INSERT INTO test2 (id, full_name)
VALUES (1, 'Jack Black'), (2, 'Joe Green'), (3, 'Jake Brown')

INSERT INTO test1
SELECT * FROM test2

SELECT * FROM test1
SELECT * FROM test2

>Each table has 50 fields so I would like to use the asterisk (*) instead
Under normal circumstances this is not a best practice, as any change to the schema of one table that was not made in the other would cause the INSERT ... * statement to throw an error.

Author

Commented:
Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial