0

I am brand new to SQL, SQL Server 2012 and SQL Databases. I have an example database already created for me that I want to import into my SQL Server. Books database

I notice that there is a Books_log with it too. What is it? (I appreciate your answer but not my main question tho).

I've tried importing it by using SQL Server Management Studio. I created a new database, then I right-clicked it and selected Tasks, then Import Data, then the Import and Export Wizard Opened, then I gave it my best guess and selected Flat File Source as my Data Source, then I clicked on Browse and selected the Books.mdf database. Then at this point I feel like there is something wrong because when I moved to the Columns or Preview tab this is what it looks like: Columns view

Anyways, I clicked on Next. I chose the .Net Framwork Data Provider for SqlServer as my Destination. Then clicked on Next and this is what I got: enter image description here

What am I doing wrong?

migrated from stackoverflow.com Sep 12 '16 at 4:06

This question came from our site for professional and enthusiast programmers.

5

Books_log is the log file for the database, i.e. all changes you make to the database are logged to be able to rollback, etc. To be able to use an existing mdf, you can use attach, right click on "Databases", click attach and select your mdf.

enter image description here

  • That seems to be taking me to toward the right path except, I am getting this now... Unable to open the physical file... Access denied – AleAng Sep 12 '16 at 2:30
  • @AleAng That I can't really help much with, copy the files to your local HDD, make sure you have access to them, make sure you are not trying to open the mdf the other database is using, no other process is accessing them, etc, could be a number of reasons but the error pretty much sums it up. – artm Sep 12 '16 at 2:33
  • @AleAng. Access denied...as in error 5? Or insufficient rights? Note that the SQL Server INSTANCE needs rights to the path. Then there must exist the correct login and finally the user must have the correct roles (like db_datawriter) granted in order to work. – clifton_h Sep 12 '16 at 6:30
  • Problem solved by: stackoverflow.com/questions/19060441/… – AleAng Sep 13 '16 at 2:34
1

There are many ways. One of the easier ways is to create a backup, copy the backup file to the other server, then restore the backup. Remember tot check the box in the restore screen that sways "Overwrite any existing database"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.