Monday, March 12, 2012
How to import Data strcture from .mdf and .ldf, not Data.
I have database files of SQL Server 2000: .mdf and .ldf. I want to
import data structure of this database into the other Microsoft SQL SERVER.
Would you tell me the way how to do it? Thanks!
Hi,
Copy the MDF and LDF files to destination server and use the below command
in query analyzer:-
sp_attach_db
'dbname','physical_mdf_name_with_path','physical_l df_name_with_path'
Thanks
Hari
MCDBA
"Terry" <terry@.gz-hyundai-motor.com.cn> wrote in message
news:2ne0imFv5rmgU1@.uni-berlin.de...
> Hi, All
> I have database files of SQL Server 2000: .mdf and .ldf. I want to
> import data structure of this database into the other Microsoft SQL
SERVER.
> Would you tell me the way how to do it? Thanks!
>
|||Terry,
Refer to this article, it's very useful.
Microsoft Knowledge Base Article - 224071
Moving SQL Server databases to a new location with Detach/Attach
http://support.microsoft.com/?id=224071
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Terry wrote:
> Hi, All
> I have database files of SQL Server 2000: .mdf and .ldf. I want to
> import data structure of this database into the other Microsoft SQL SERVER.
> Would you tell me the way how to do it? Thanks!
>
|||If you are talking about just the structure of a database (and not structure
and data) then you could use Enterprise Manager to script the database
(right click db/ All Tasks/ Generate Script) and you could execute that
against the new server OR you could use DTS.
If you wanted both however, the aforementioned method (by Mark Allison) is
probably easiest.
Br,
Mark.
"Terry" <terry@.gz-hyundai-motor.com.cn> wrote in message
news:2ne0imFv5rmgU1@.uni-berlin.de...
> Hi, All
> I have database files of SQL Server 2000: .mdf and .ldf. I want to
> import data structure of this database into the other Microsoft SQL
SERVER.
> Would you tell me the way how to do it? Thanks!
>
|||Thank you very much!
"Mark Allison" <marka@.no.tinned.meat.mvps.org>
?:#Bs1Q2reEHA.1656@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Terry,
> Refer to this article, it's very useful.
> Microsoft Knowledge Base Article - 224071
> Moving SQL Server databases to a new location with Detach/Attach
> http://support.microsoft.com/?id=224071
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
>
> Terry wrote:
SERVER.[vbcol=seagreen]
How to import Data strcture from .mdf and .ldf, not Data.
I have database files of SQL Server 2000: .mdf and .ldf. I want to
import data structure of this database into the other Microsoft SQL SERVER.
Would you tell me the way how to do it? Thanks!Hi,
Copy the MDF and LDF files to destination server and use the below command
in query analyzer:-
sp_attach_db
'dbname','physical_mdf_name_with_path','
physical_ldf_name_with_path'
Thanks
Hari
MCDBA
"Terry" <terry@.gz-hyundai-motor.com.cn> wrote in message
news:2ne0imFv5rmgU1@.uni-berlin.de...
> Hi, All
> I have database files of SQL Server 2000: .mdf and .ldf. I want to
> import data structure of this database into the other Microsoft SQL
SERVER.
> Would you tell me the way how to do it? Thanks!
>|||Terry,
Refer to this article, it's very useful.
Microsoft Knowledge Base Article - 224071
Moving SQL Server databases to a new location with Detach/Attach
http://support.microsoft.com/?id=224071
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Terry wrote:
> Hi, All
> I have database files of SQL Server 2000: .mdf and .ldf. I want to
> import data structure of this database into the other Microsoft SQL SERVER
.
> Would you tell me the way how to do it? Thanks!
>|||If you are talking about just the structure of a database (and not structure
and data) then you could use Enterprise Manager to script the database
(right click db/ All Tasks/ Generate Script) and you could execute that
against the new server OR you could use DTS.
If you wanted both however, the aforementioned method (by Mark Allison) is
probably easiest.
Br,
Mark.
"Terry" <terry@.gz-hyundai-motor.com.cn> wrote in message
news:2ne0imFv5rmgU1@.uni-berlin.de...
> Hi, All
> I have database files of SQL Server 2000: .mdf and .ldf. I want to
> import data structure of this database into the other Microsoft SQL
SERVER.
> Would you tell me the way how to do it? Thanks!
>|||Thank you very much!
"Mark Allison" <marka@.no.tinned.meat.mvps.org>
':#Bs1Q2reEHA.1656@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Terry,
> Refer to this article, it's very useful.
> Microsoft Knowledge Base Article - 224071
> Moving SQL Server databases to a new location with Detach/Attach
> http://support.microsoft.com/?id=224071
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
>
> Terry wrote:
SERVER.[vbcol=seagreen]
How to import Data strcture from .mdf and .ldf, not Data.
I have database files of SQL Server 2000: .mdf and .ldf. I want to
import data structure of this database into the other Microsoft SQL SERVER.
Would you tell me the way how to do it? Thanks!Hi,
Copy the MDF and LDF files to destination server and use the below command
in query analyzer:-
sp_attach_db
'dbname','physical_mdf_name_with_path','physical_ldf_name_with_path'
Thanks
Hari
MCDBA
"Terry" <terry@.gz-hyundai-motor.com.cn> wrote in message
news:2ne0imFv5rmgU1@.uni-berlin.de...
> Hi, All
> I have database files of SQL Server 2000: .mdf and .ldf. I want to
> import data structure of this database into the other Microsoft SQL
SERVER.
> Would you tell me the way how to do it? Thanks!
>|||Terry,
Refer to this article, it's very useful.
Microsoft Knowledge Base Article - 224071
Moving SQL Server databases to a new location with Detach/Attach
http://support.microsoft.com/?id=224071
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Terry wrote:
> Hi, All
> I have database files of SQL Server 2000: .mdf and .ldf. I want to
> import data structure of this database into the other Microsoft SQL SERVER.
> Would you tell me the way how to do it? Thanks!
>|||If you are talking about just the structure of a database (and not structure
and data) then you could use Enterprise Manager to script the database
(right click db/ All Tasks/ Generate Script) and you could execute that
against the new server OR you could use DTS.
If you wanted both however, the aforementioned method (by Mark Allison) is
probably easiest.
Br,
Mark.
"Terry" <terry@.gz-hyundai-motor.com.cn> wrote in message
news:2ne0imFv5rmgU1@.uni-berlin.de...
> Hi, All
> I have database files of SQL Server 2000: .mdf and .ldf. I want to
> import data structure of this database into the other Microsoft SQL
SERVER.
> Would you tell me the way how to do it? Thanks!
>|||Thank you very much!
"Mark Allison" <marka@.no.tinned.meat.mvps.org>
':#Bs1Q2reEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Terry,
> Refer to this article, it's very useful.
> Microsoft Knowledge Base Article - 224071
> Moving SQL Server databases to a new location with Detach/Attach
> http://support.microsoft.com/?id=224071
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
>
> Terry wrote:
> > Hi, All
> > I have database files of SQL Server 2000: .mdf and .ldf. I want to
> > import data structure of this database into the other Microsoft SQL
SERVER.
> > Would you tell me the way how to do it? Thanks!
> >
> >
Friday, March 9, 2012
How to import an mdf-file
Regards,
Olav
Try attaching the file using sp_attach_single_file_db. You
can find more information on using this stored procedure in
books online.
-Sue
On Tue, 25 May 2004 04:26:04 -0700, "Olav"
<anonymous@.discussions.microsoft.com> wrote:
>Hi,on my developement PC i have installed MS Sql server. A customer with my program using msde sent me his .mdf file so that i can check his data. How do i import or connect to his database file for debugging?
>Regards,
>Olav
|||You can try the stored procedure sp_attach_single_file_db (see Books Online
for usage and syntax). Without a log file, if the database wasn't cleanly
detached, it's not a guaranteed move. You should try to get the user to
send you a synchronized and properly detached MDF+LDF pair.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Olav" <anonymous@.discussions.microsoft.com> wrote in message
news:E7DC9CD6-1952-4896-9C62-5D9C311674A0@.microsoft.com...
> Hi,on my developement PC i have installed MS Sql server. A customer with
> my program using msde sent me his .mdf file so that i can check his data.
> How do i import or connect to his database file for debugging?
> Regards,
> Olav
|||Thanks a lot, it worked!
Is there a better way to connect a customer database?
Regards,
Olav
|||If all you have is an mdf, it seems the only choice you'd
have would be sp_attach_single_file_db.
The customer should make sure to use sp_detach_db if you are
going to attach a database using sp_attach_db or
sp_attach_single_file_db.
Another option would be for the customer to give you a
backup file. You can restore this backup to your server.
-Sue
On Tue, 25 May 2004 05:21:05 -0700, "Olav"
<anonymous@.discussions.microsoft.com> wrote:
>Thanks a lot, it worked!
>Is there a better way to connect a customer database?
>Regards,
>Olav
How to import an mdf-file
Regards
OlavTry attaching the file using sp_attach_single_file_db. You
can find more information on using this stored procedure in
books online.
-Sue
On Tue, 25 May 2004 04:26:04 -0700, "Olav"
<anonymous@.discussions.microsoft.com> wrote:
>Hi,on my developement PC i have installed MS Sql server. A customer with my program using msde sent me his .mdf file so that i can check his data. How do i import or connect to his database file for debugging?
>Regards,
>Olav|||You can try the stored procedure sp_attach_single_file_db (see Books Online
for usage and syntax). Without a log file, if the database wasn't cleanly
detached, it's not a guaranteed move. You should try to get the user to
send you a synchronized and properly detached MDF+LDF pair.
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Olav" <anonymous@.discussions.microsoft.com> wrote in message
news:E7DC9CD6-1952-4896-9C62-5D9C311674A0@.microsoft.com...
> Hi,on my developement PC i have installed MS Sql server. A customer with
> my program using msde sent me his .mdf file so that i can check his data.
> How do i import or connect to his database file for debugging?
> Regards,
> Olav|||Thanks a lot, it worked
Is there a better way to connect a customer database
Regards,
Olav|||If all you have is an mdf, it seems the only choice you'd
have would be sp_attach_single_file_db.
The customer should make sure to use sp_detach_db if you are
going to attach a database using sp_attach_db or
sp_attach_single_file_db.
Another option would be for the customer to give you a
backup file. You can restore this backup to your server.
-Sue
On Tue, 25 May 2004 05:21:05 -0700, "Olav"
<anonymous@.discussions.microsoft.com> wrote:
>Thanks a lot, it worked!
>Is there a better way to connect a customer database?
>Regards,
>Olav
How to import an mdf-file
program using msde sent me his .mdf file so that i can check his data. How
do i import or connect to his database file for debugging?
Regards,
OlavTry attaching the file using sp_attach_single_file_db. You
can find more information on using this stored procedure in
books online.
-Sue
On Tue, 25 May 2004 04:26:04 -0700, "Olav"
<anonymous@.discussions.microsoft.com> wrote:
>Hi,on my developement PC i have installed MS Sql server. A customer with m
y program using msde sent me his .mdf file so that i can check his data. How
do i import or connect to his database file for debugging?
>Regards,
>Olav|||You can try the stored procedure sp_attach_single_file_db (see Books Online
for usage and syntax). Without a log file, if the database wasn't cleanly
detached, it's not a guaranteed move. You should try to get the user to
send you a synchronized and properly detached MDF+LDF pair.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Olav" <anonymous@.discussions.microsoft.com> wrote in message
news:E7DC9CD6-1952-4896-9C62-5D9C311674A0@.microsoft.com...
> Hi,on my developement PC i have installed MS Sql server. A customer with
> my program using msde sent me his .mdf file so that i can check his data.
> How do i import or connect to his database file for debugging?
> Regards,
> Olav|||Thanks a lot, it worked!
Is there a better way to connect a customer database?
Regards,
Olav|||If all you have is an mdf, it seems the only choice you'd
have would be sp_attach_single_file_db.
The customer should make sure to use sp_detach_db if you are
going to attach a database using sp_attach_db or
sp_attach_single_file_db.
Another option would be for the customer to give you a
backup file. You can restore this backup to your server.
-Sue
On Tue, 25 May 2004 05:21:05 -0700, "Olav"
<anonymous@.discussions.microsoft.com> wrote:
>Thanks a lot, it worked!
>Is there a better way to connect a customer database?
>Regards,
>Olav
How to import an mdf file or script into ms sql 2000 or 2005
How can I import an mdf file or sql script in ms sql 2000 orms sql 2005, also how to do the same if it is am aceess database?
Thank you
Darlene
From within the sql server studio, right click on the databases entry. The task you are looking for is "attach database".
Grab the .mdf file for the db to install. ( It may try to grab a .log file that is in the wrong directory, if so, delete the reference to it on the screen. It will create another log file in the same directory as the .mdf file.)
As for access, you are on your own. :)
How to import an mdf file into SQL Server Management Studio Express?
Hi
I had to recover my computer but before I did that I grabbed a new version of my mdf file but I don't know how to actually import it into SQL Server Management Studio Express evertime I try to open the file up it just crashes.
I rather not have to redue that whole database again. I am a noob so step by step instructions are needed.
Thanks
Open SQL Management Studio Express and log in to the server to which you want to attach the database. In the 'Object Explorer' window, right-click on the 'Databases' folder and select 'Attach...' The 'Attach Databases' window will open; inside that window click 'Add...' and then navigate to your .MDF file and click 'OK'. Click 'OK' once more to finish attaching the database and you are done. The database should be available for use.
Thanks but I get an error.



I think I got it working.
|||
aggiekevin:
Open SQL Management Studio Express and log in to the server to which you want to attach the database. In the 'Object Explorer' window, right-click on the 'Databases' folder and select 'Attach...' The 'Attach Databases' window will open; inside that window click 'Add...' and then navigate to your .MDF file and click 'OK'. Click 'OK' once more to finish attaching the database and you are done. The database should be available for use.
This is true. One important note I would like to menion is, it is highly recomended to take a copy of .mdf file bedore attaching it to the new database. Why? Because if this .mdf file was one of the SQL Server 2000 databases and you attached it to one of the SQL Server 2005 databases. There is no way -if you wish in futute- to detach that .mdf file from SQL Server 2005 and attached it again in SQL Server 2000 or eailer version.
Good luck.
|||Thanks
How to import *.mdf file
I have a SQL Server 2005 database *.mdf file that I would like to import into another SQL Server 2005 engine on another computer. I don't see how to do this.
How can I import a *.mdf file to create a copy of an exiisting database from another computer?
Thanks.
Hi there,If you want a copy of the database on both servers then you can use the Copy Database Wizard. On the server that hosts the DB you want to copy, right click on the "Databases" node in Object Explorer then go Tasks > Copy Database.
If you only want a database on one server, you can detach the database by right clicking on the "Databases" node in Object Explorer then going Tasks > Detach. If you're .mdf file isn't currently attached to a database, then ignore this bit and see below.
After detaching you can copy the .mdf and .ldf files to your target server and in Mangement Studio on your target server you can right click on the "Databases" node in Object Explorer then select the Attach option (it's either Attach or Tasks > Attach, one of those anyway)
Hope that helps a bit, but sorry if it doesn't
|||
Using Attach in the Object Explorer did the trick.
Why can't they make this easier and more consistent with other software? Why can't the us Import or Add From File under Databases or something as equally obvious? Why doesn't the documentation have help on Importing *.mdf files?
Thanks Very Much for the Assistance.
|||Hi,
I'm trying to open a *.mdf with Microsoft SQL Server 2005 Express on Vista. The Tasks menu does not appear when I click databases in Object Explorer. How do I see my databases?
Any hints appreciated. I've tried 'restore database' but get the error message below.
HS
TITLE: Microsoft SQL Server Management Studio Express
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
ADDITIONAL INFORMATION:
The media family on device '*.Mdf' is incorrectly formed. SQL Server cannot process this media family.
RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=3241&LinkId=20476
BUTTONS:
OK
How to import *.mdf file
I have a SQL Server 2005 database *.mdf file that I would like to import into another SQL Server 2005 engine on another computer. I don't see how to do this.
How can I import a *.mdf file to create a copy of an exiisting database from another computer?
Thanks.
Hi there,If you want a copy of the database on both servers then you can use the Copy Database Wizard. On the server that hosts the DB you want to copy, right click on the "Databases" node in Object Explorer then go Tasks > Copy Database.
If you only want a database on one server, you can detach the database by right clicking on the "Databases" node in Object Explorer then going Tasks > Detach. If you're .mdf file isn't currently attached to a database, then ignore this bit and see below.
After detaching you can copy the .mdf and .ldf files to your target server and in Mangement Studio on your target server you can right click on the "Databases" node in Object Explorer then select the Attach option (it's either Attach or Tasks > Attach, one of those anyway)
Hope that helps a bit, but sorry if it doesn't
|||
Using Attach in the Object Explorer did the trick.
Why can't they make this easier and more consistent with other software? Why can't the us Import or Add From File under Databases or something as equally obvious? Why doesn't the documentation have help on Importing *.mdf files?
Thanks Very Much for the Assistance.
|||Hi,
I'm trying to open a *.mdf with Microsoft SQL Server 2005 Express on Vista. The Tasks menu does not appear when I click databases in Object Explorer. How do I see my databases?
Any hints appreciated. I've tried 'restore database' but get the error message below.
HS
TITLE: Microsoft SQL Server Management Studio Express
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
ADDITIONAL INFORMATION:
The media family on device '*.Mdf' is incorrectly formed. SQL Server cannot process this media family.
RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=3241&LinkId=20476
BUTTONS:
OK