Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 migrate tables from sql 2000 to 2005

Author  Topic 

scabral7
Yak Posting Veteran

57 Posts

Posted - 2010-05-20 : 14:59:31
Hi,

i have about 50-60 tables in SQL 2000 that i need to move to SQL 2005. The issue is that most of the tables are already in the SQL 2005 database with old data and some of the tables are not there yet.

So i need a way to create the tables if they need to be created in SQL 2005 and then truncate the table and move the data from the 2000 table to the 2005 table. I hope that makes sense.

is there a good way to do this?

thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-20 : 15:30:21
Why don't you just backup/restore instead? If that's not possible, then why not just drop the tables in 2005 and then grab everything from 2000? Or you could use IF EXISTS (SELECT *...)


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-20 : 15:54:11
If table does not exist then create it

If table does exist then truncate it

Have I got that right? If so why not drop the table if it exists, then create it? SSMS can generate a script to do just that.

Are there other tables (not part of this job) which will stay?

You can use DTS / SSIS to move the data across - but best to pre-create the tables (so they have all the appropriate defaults etc.) but you may want top create Indexes and Foreign Key constraints after copying the data over (otherwise you may have problems with importing the data in the right order to prevent referential integrity errors)
Go to Top of Page
   

- Advertisement -