Exporting a SQL Server DB

Hi

I have a db in SQLServer Express 2005.  I simply need to export this in its entirety (data and structure) so that it can be imported into another instance of SQL Server Express 2005.  What is the best way of doing this?
kenabbottAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sm394Commented:
deattach db
copy to new location
and
attach db
0
ErnariashCommented:
Hello,
Back-Up / Restore
Detach / Attach
0
sm394Commented:
Pic for example
db.GIF
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

sm394Commented:
if you couldn't detach or copy  try taking database offline first
0
kenabbottAuthor Commented:
Thanks - but if you detach the db aren't you in effect moving it from one place to another.  What if you want to keep the db where it is and simply move a copy to the second location.

Also in mySQL I'ce used 'Dump SQL File' and then 'Execute batch file' to copy db's from one place to another - is there an equivalent in SQL Server??
0
ErnariashCommented:

As on the sm394 picture is an option to Copy Database is a wizard you will have options on it.
The problem with Detach / Attach you take your db ofline. For online copy you can use backup and restore  (with move if need it)

BACKUP DATABASE YourDB 
   TO DISK = 'c:\YourDB.bak'
RESTORE FILELISTONLY 
   FROM DISK = 'c:\YourDB.bak'
RESTORE DATABASE YourDB3 
   FROM DISK = 'c:\YourDB.bak'
   WITH MOVE 'YourDB_Data' TO 'c:\YourDB3.mdf' 

Open in new window

0
sm394Commented:
as Ernariash explained there are number of different options to do this task
with detach and taking database offline

you  copy the database .mdf files in to new location and attach them again
after copying mdf files you can bring db online again
0
sm394Commented:
the steps involved  for this
1-Take database offline
2-go to C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data
  or the directory you have installed sql server
3- copy yourdb.mdf and youdb.ldf files
4- paste in new location
5- final step is right click properties attach browse for mdf ldf files
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.