Take the 2-minute tour ×
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. It's 100% free, no registration required.

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 stackoverflow.com Sep 21 '12 at 15:58

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

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

2 Answers 2

up vote 1 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
add comment

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]
GO

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

@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
add comment

Your Answer

 
discard

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