Avatar of EYoung
EYoung
Flag for United States of America asked on

How append records from table

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
Microsoft SQL Server

Avatar of undefined
Last Comment
EYoung

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jim Horn

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jim Horn

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.
EYoung

ASKER
Thank you
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck