Solved

how can i import mdf file into sql server 2008 ??

Posted on 2011-03-04
7
853 Views
Last Modified: 2012-05-11
suppose i have data.mdf file then how can i import into sql server 2008 using query or stored procedure ??

Give me some suggestions ...
0
Comment
Question by:Parth48
  • 3
  • 2
  • 2
7 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35034479
you cannot "import" data from a .mdf.
the only thing you can do is attach the file as database (presuming it's the full database) using sp_attach_db procedure.

if the source database had other files (apart from the .ldf files), you cannot attach it alone.
0
 

Author Comment

by:Parth48
ID: 35034768
hi @angelll: u r right but how can use it ?

use question_assistant

EXEC sp_attach_db @dbname = N'AdventureWorks2008R2', 
    @filename1 = N'C:\Documents and Settings\Administrator\Desktop\Data\AdventureWorksLT2008_Data.mdf', 
    @filename2 = N'C:\Documents and Settings\Administrator\Desktop\Data\AdventureWorksLT2008_Log.ldf';

Open in new window


but i got error in above code ....


Msg 1813, Level 16, State 2, Line 1
Could not open new database 'AdventureWorks2008R2'. CREATE DATABASE is aborted.
Msg 948, Level 20, State 1, Line 1
The database 'AdventureWorks2008R2' cannot be opened because it is version 655. This server supports version 654 and earlier. A downgrade path is not supported.


what can i do now ??
0
 
LVL 13

Expert Comment

by:geek_vj
ID: 35034775
>>The database 'AdventureWorks2008R2' cannot be opened because it is version 655. This server supports version 654 and earlier. A downgrade path is not supported.

This cant be done as downgrading is not possible in sql server.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 35034779
you cannot attach that .mdf file on your database, as it is "older" than the version you want to restore from.
options:
* restore on a db with the correct version
* update your instance to that same version
0
 

Author Comment

by:Parth48
ID: 35034947
but where i can find 'AdventureWorks2008R2' version 654 ??

or how can i restore on a db with the correct version ??
0
 

Author Comment

by:Parth48
ID: 35035194
can u please tell me how can i create mdf file for my database ??
0
 
LVL 13

Expert Comment

by:geek_vj
ID: 35035211
>> can u please tell me how can i create mdf file for my database ??
mdf file will be automatically created whenever you create a database. This file is usually called data file. Also, a file with extension .ldf will be created along with it which is called log file.

>>but where i can find 'AdventureWorks2008R2' version 654 ??
Please check in codeplex.com

>>or how can i restore on a db with the correct version ??
You have to download the correct version and restore it accordingly.

0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Articles on a wide range of technology and professional topics are available on Experts Exchange. These resources are written by members, for members, and can be written about any topic you feel passionate about. Learn how to best write an article t…
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now