SQL Server 2012 – How to Import Existing Database

sql serversql-server-2012ssms

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?

Best Answer

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

Related Question