Wednesday, March 28, 2012

Import MDF SQL 2000 file into SQL 2005 Express

Is it possible?
I only have the MDF from my SQL 2000 DB, and I need to import it to SQL
Server 2005...
Best Regards
Fabio CavassiniYou might try CREATE DATABASE...FOR ATTACH_REBUILD_LOG. This should work if
the database was properly detached from the SQL 2000 instance. See the SQL
2005 Books Online for more information.
Hope this helps.
Dan Guzman
SQL Server MVP
"Fabio Cavassini" <cavassinif@.gmail.com> wrote in message
news:1138068510.765889.178750@.g44g2000cwa.googlegroups.com...
> Is it possible?
> I only have the MDF from my SQL 2000 DB, and I need to import it to SQL
> Server 2005...
> Best Regards
> Fabio Cavassini
>|||Thanks Dan
I tried to attach it with sp_attach_db and it works...it converts the
format to the new version.
After that I got the following error when I want to create a Diagram:
"Database diagram support objects cannot be installed because this
database does not have a valid owner. To continue, first use the Files
page of the Database Properties dialog box or the ALTER AUTHORIZATION
statement to set the database owner to a valid login, then add the
database diagram support objects."
that this code fix...
EXEC sp_dbcmptlevel 'yourDB', '90';
go
ALTER AUTHORIZATION ON DATABASE::yourDB TO "yourLogin"
go
use [yourDB]
go
EXECUTE AS USER = N'dbo' REVERT
go
Best Regards
Fabio Cavassini|||> I tried to attach it with sp_attach_db and it works...it converts the
> format to the new version.
Just like the SQL 2000 version, sp_attach_db is basically just a wrapper for
CREATE DATABASE...FOR ATTACH. I don't recommend it in SQL 2005 because it
will be discontinued in a future version so you might as well get used to it
(or use a GUI that does this for you). From the SQL Server 2005 Books
Online:
<Excerpt
href="ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/59bc993e-7913-4091
-89cb-d2871cffda95.htm">
Important:
This feature will be removed in a future version of Microsoft SQL Server.
Avoid using this feature in new development work, and plan to modify
applications that currently use this feature. We recommend that you use
CREATE DATABASE database_name FOR ATTACH instead. For more information, see
CREATE DATABASE (Transact-SQL).
</Excerpt>
Hope this helps.
Dan Guzman
SQL Server MVP
"Fabio Cavassini" <cavassinif@.gmail.com> wrote in message
news:1138070344.185793.284520@.f14g2000cwb.googlegroups.com...
> Thanks Dan
> I tried to attach it with sp_attach_db and it works...it converts the
> format to the new version.
> After that I got the following error when I want to create a Diagram:
> "Database diagram support objects cannot be installed because this
> database does not have a valid owner. To continue, first use the Files
> page of the Database Properties dialog box or the ALTER AUTHORIZATION
> statement to set the database owner to a valid login, then add the
> database diagram support objects."
> that this code fix...
> EXEC sp_dbcmptlevel 'yourDB', '90';
> go
> ALTER AUTHORIZATION ON DATABASE::yourDB TO "yourLogin"
> go
> use [yourDB]
> go
> EXECUTE AS USER = N'dbo' REVERT
> go
> Best Regards
> Fabio Cavassini
>|||Thanks for the info Dan, I'll consider it.
Best Regards
Fabio Cavassinisql

No comments:

Post a Comment