moving data from active into archive table

I've got a SQL Server 2008 R2 database which contains two identical tables, one for "current" records and one for "archived" records (not my choice, but what I have to work with).

I'd like to move records from the current table to the archive table without explicitly identifying the 75+ fields in the two tables.

I'm hoping there is a way to do something like:

INSERT INTO tbl_Archive
SELECT * FROM tbl_Current
INNER JOIN tbl_Archived_IDs on tbl_Current.ID = tbl_ArchivedIDs.Id

And then do a deletion from tbl_Current, for those records which were just copied.

If there is an easy way to do this, please advise.
LVL 50
Dale FyeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike EghtebasDatabase and Application DeveloperCommented:
INSERT INTO tbl_Archive
SELECT * FROM tbl_Current

should work without join part but tbl_ArchivedIDs.Id should be altered to be int if tbl_Current.ID in int identity.

But it should this could be part of a transaction in case there is an error in the next delete part (see below), it can roll it back.

Delete From tbl_Current;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeAuthor Commented:
Turned out that there was an Identity column in each of the tables, as well as a timestamp field, so
I simply scripted the table out to a query and deleted those two fields from the field list and then added the fields into the INSERT INTO ( ) and SELECT clauses.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.