Solved

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

Posted on 2011-03-04
7
880 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 143

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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 143

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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Search all sub-folder 4 46
MS SQL GROUP BY 6 72
How do I email customer service or support at Amazon? 16 85
SQL syntax question 6 38
Gift cards are not a new concept - it's been around for a very long time.  Undoubtedly, over the past you have received such a card or purchased one for a friend or relative.  Are you aware that you've been feeding the machine?  If not, read on :)
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…

740 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