Avatar of GeorgesIT
GeorgesIT
 asked on

Move Table to new Database

I am trying to move a table "SCANPaq_Archive" to a new database on the same SQL Server. What would be the correct way to do this? Looking for sql more than using DTS if possible.
Microsoft SQL Server

Avatar of undefined
Last Comment
GeorgesIT

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
jdera

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Aneesh

Hello GeorgesIT,

create a new database in simple recovery model
run an "select * into newdbname..tableName from tableName " 
create indexes
rename the other table
and test test tst


GOD Bless
aneeshattingal
jdera

However, if your database is in another ms sql server, you can do this :

Connect to your database using management studio. Right click on your table and select Script Table As > Create To > New Query Editor Window

Connect to the other database you want the table to be copied, create a new query and paste the sql previously generated. Run the query and you are done!
GeorgesIT

ASKER
That's what I needed. Quick and easy. Thanks!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23