Copy Table in SQL2000

I am new to SQL. and this was in place when I started here.
I have a sql2000 database.  It is opened with SQL Server manager 2005.
I have a table that needs to be archived every so often.  The table is called TEST.

I need to copy the entire table ( data and columns) to a table called TEST01.  Then need to erase all data in TEST so it is empty.

Should I rename TEST to TEST01 then copy the table structure to a new table call TEST?
How can I do this and what commands would it be.


 
mleidichAsked:
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.

Anil GolamariCommented:
If you have Test01 table already created then easy way to copy the data from Test table to Test01 table is creating a DTS package if you don't have SSIS package available. In this way you can schedule this package to run and at the same time one's you copy the whole content to Test01 table you can delete the data from Test table.
0
mleidichAuthor Commented:
No TEST01 is not created yet.  I need it to be an exact copy of TEST.
How would I do this?
0
Anthony PerkinsCommented:
>>I need to copy the entire table ( data and columns) to a table called TEST01. <<
SELECT * INTO TEST01 FROM TEST

>>Then need to erase all data in TEST so it is empty.<<
If no Foreign keys: TRUNCATE TABLE TEST
Else: DELETE TEST
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mleidichAuthor Commented:
where do you type SELECT * INTO?

Will DELETE TEST  - delete the table?

Will TRUNCATE erase all data in the table?
0
Ramkisan JagtapLead DeveloperCommented:
select * into test01 from test
0
mleidichAuthor Commented:
I see the table names on the left.  I highlight the name of the table.  I do not see how to type or select the command SELECT from TEST.
0
Anthony PerkinsCommented:
You will click on New Query on the top left corner below the File menu and then type in the query I posted.

Read up on DELETE and TRUNCATE TABLE in SQL Server BOL.
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
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.