Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the Sql Server 2012 Import and Export data (64) i'm not sure what options i should be picking to do what i want. I just want to be able to export all the data in the database to a file which i can then send to my other machine and then import the database.

The databases just contains tables.

share|improve this question

migrated from Sep 21 '12 at 15:58

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

Right click the db, tasks, back it up to a .bak & restore? – Alex K. Sep 20 '12 at 11:26
up vote 4 down vote accepted

I upvoted the comment by @Alex K. as this, I believe, is the easiest way of accomplish what you want. Backup the database, when asked copy the .bak file where you think is better for your needs, maybe even you can copy it already in a place where the other PC has access. Then do the opposite on the other SQL Server instance on the other PC, restore the database from the .bak previously saved.

Here is a link to a detailed description on how to backup the database using SSMS.

And here how to restore using the SSMS.

share|improve this answer

You should be able copy the MDF to the other machine and attach it.

Step 1: Copy your file from PC-1 to PC-2 and put the file in the following folder (or where ever you installed the SQL Server data files):

C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\

Step 2:

USE [master]

EXEC sp_attach_single_file_db @dbname='HotelProject',
@physname=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\HotelProject.mdf'

@dbname is the database name that you want to attach the file to.

@phyname is the path + filename where the MDF file is stored on the hard drive.

N' make the literal string NVARCHAR instead of VARCHAR.

Use import/export when you only want part of the database, like a particular group of related tables. I don't normally use this to export to a flat file, but here is a good example on how to do it.

share|improve this answer
USE [master] GO EXEC sp_attach_single_file_db @HotelProject='HotelProject', @KHAN-PC=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\HotelProject.mdf' GO Whats @physname=N? – user1638362 Sep 20 '12 at 11:27
@user1638362 - updated my answer with your MDF. I'm not sure if 2012 data files are installed in MSSQL10 or not, so make sure your path is correct. – Chris Gessler Sep 20 '12 at 11:43
Import and Export SQL server database can be easily performed via Import and Export Wizard. Take a look on this blog: – Jason Clark Jan 14 at 6:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.