Solved

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

Posted on 2011-03-04
7
841 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

One of the biggest challenges facing freelancers is balancing multiple projects and deadlines. Organizational skills and time management are key to keeping up with projects and staying on track. Luckily, we’ve curated seven tools to help you focus o…
This story has been written with permission from the scammed victim, a valued client of mine – identity protected by request.
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…
Saved searches can save you time by quickly referencing commonly searched terms on any topic. Whether you are looking for questions you can answer or hoping to learn about a specific issue, a saved search can help you get the most out of your time o…

744 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

13 Experts available now in Live!

Get 1:1 Help Now