Re: How to migrate Database from SQL Server 2000 to 2005

Tech-Archive recommends: Fix windows errors by optimizing your registry



yogee (yogee@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
These are the methods I have used to migrate my database tables (I don't
want data):
1. Generate SQL Query by Right Click on Database and Generate Query from
SQL Server 2000 (selecting all options i.e. All Tables, Views etc...).
Run that SQL query in SQL Server 2005 and all tables are generated.
Problem: Database tables are imported but foreign key relationship has
gone !! :(

Sounds strange. I ran Generate Scripts from Mgmt Studio on an database
on SQL 2000. I checked "Script all objects". I retained the default
settings, except that I changed "Continue Scripting on Error" to True, since
that database has a multi-statement UDF, and a bug prevents Mgmt Studio from
scripting such function on SQL 2000. I did not actually run the script,
but I searched the scripts, and my foreign keys were there.

2. Take back up from SQL Server 2000 and restore that in SQL Server 2005.
All database tables are comming correctly with primary and foreign key
relations.
Problem: When I click on diagram I get these weird errors.
Error1: Failed to retrieve data for this request.
(Microsoft.SqlServer.SmoEnum)
Error2: An exception occurred while executing a Transact-SQL statement or
batch. (Microsoft.SqlServer.ConnectionInfo)
{Cannot execute as the database principal because the principal "dbo" does
not exist, this type of principal cannot be impersonated, or you do not
have permission. (Microsoft SQL Server, Error: 15517)}

This is because when you move the database from one server to another,
dbo within the database no longer maps to an existing login on the server.
This is required for diagramming, because some of the procedures has EXECUTE
AS "dbo" in them.

As I recall, you should be able to fix this with changing the database
owner with ALTER AUTHORIZATION. (Or sp_changedbobjectowner, but why not
exercise on the new syntax.)


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



Relevant Pages

  • xSQL Object 2.5.2.7
    ... synchronizing SQL Server databases. ... Server 2000 database with a SQL Server 2005 database and generate ... history of the schema changes and provide for safe and ... differences, view the scripts of objects, filter results and more; ...
    (comp.software.shareware.announce)
  • Re: MS Access DAO -> ADO.NET Migration
    ... William Vaughn ... Microsoft MVP ... Hitchhiker's Guide to Visual Studio and SQL Server ... My migration app works building a SSCE database file with imported data ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Cluster will not fail over.
    ... > As far as the TCP/IP issue goes, you had to rebuild the cluster and were ... > able to restore the master database. ... > a cluster installation you'll have to revisit. ... >> This worked bringing up the sql server in minimal mode. ...
    (microsoft.public.sqlserver.clustering)
  • Re: MS Access DAO -> ADO.NET Migration
    ... full SQL Server and I see the logic you explained in a multi user ... allow two users to access the same database file Read/Write at any given ... The book was a pleasure to read after the gibberish that Microsoft 'puts ... Hitchhiker's Guide to Visual Studio and SQL Server ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: MS Access DAO -> ADO.NET Migration
    ... For that it is much harder to handle the incremental identifier, ... database but although they have the data, they are not connected at the same ... The book was a pleasure to read after the gibberish that Microsoft 'puts ... SQL Server Management Studio is nowhere to be found on my ...
    (microsoft.public.dotnet.framework.adonet)