Solved

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

Posted on 2011-03-04
7
861 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Notifications on Experts Exchange help you keep track of your activity and updates in one place. Watch this video to learn how to use them on the site to quickly access the content that matters to you.
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…

803 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