Re: SQL Server 6.5 Data Conversion
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Fri, 27 Jul 2007 09:50:29 +0000 (UTC)
Gudni G. Sigurdsson (GudniGSigurdsson@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
I need to convert SQL Server 6.5 data to SQL Server 2005 (Express). How
do I do that? Where do I get the necessary tools?
If you want to do it with wizards etc, you need to first get hold of SQL
2000. There is no direct upgrade path.
However, I would suggest that you are best of rolling your own. If you
have the scripts for the database definition under version control, use
these. Else script the database definition from the 6.5 Enterprise Manager.
Then run the script on SQL 2005.
To move the data, run this on SQL 6.5:
SELECT 'bcp db..' + name + ' format dummy -f ' +
name + '.fmt -n -U sa -P xxx -S SQL65'
FROM sysobjects
WHERE type = 'U'
Copy the output to a .CMD file and run in an empty directory. This create
format files for the export.
Then run
SELECT 'bcp db..' + name + ' out ' + name + '.bcp -f ' +
name + '.fmt -U sa -P xxx -S SQL65'
FROM sysobjects
WHERE type = 'U'
Again, copy the output and run. You have now exported the data. Next:
SELECT 'bcp db..' + name + ' in ' + name + '.bcp -f ' +
name + '.fmt -T -S SERVER\SQLEXPRESS -E'
FROM sysobjects
WHERE type = 'U'
Copy and run again. You have now loaded the data.
At this point run in SQL 2005:
DBCC CHECKCONSTRAINTS
EXEC sp_updatestats
If this reports any errors, analyse and repair.
Run in SQL 2005:
SELECT 'ALTER TABLE ' + name + ' NOCHECK CONSTRAINT ALL; ' +
'ALTER TABLE ' + name + ' WITH CHECK CONSTRAINT ALL'
FROM sys.objects
WHERE type = 'U'
Copy and run output in a query window.
This ensures that all constraints are trusted. If constraints are not
trusted, the optimizer will ignore them, and this can lead to performance
degradation.
Note: all of this was typed on free hand, so there may be some syntax
errors here and there. I encourage to you look closer in Books Online
what these commands do.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Prev by Date: Re: Manage MSDE databases with SSMS??
- Next by Date: Re: SQL Profiler 2005
- Previous by thread: Re: SQL Profiler 2005
- Next by thread: SqlWB BSOD on Table Data Edit 1000008e
- Index(es):
Relevant Pages
|