• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

Moving data from one SQL database to another

I need to move data from one SQL database to another, I am using SQL Server 2005 but dont know much about it. I can run scripts if someone provides with the code. My knowledge so far has allowed me to setup a new database, run a script to create the tables and set security for the db, and thats Im afraid.

An "SQL for dummies" type explanation would be very much appreciated.




0
3can
Asked:
3can
  • 4
  • 3
  • 3
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
Option1 : using "Copy database wizard"
Right click on the database ->Tasks ->Copy database wizard
Now you just need to enter the user credentials and the SQL server instance to which you need to attach this db.
0
 
Jai STech ArchCommented:
open management studio(SSMS)
--> select the database --> right click --> Export
the export wizard will be opened...
click next
select the source database (from which you want to export your data)
next
select the destination database(to where you want to export)
select the tables you want to export...
complete the wizard...
you data are transfered.
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
Make a copy of a database using BACKUP and RESTORE
This example uses both the BACKUP and RESTORE statements to make a copy of the Northwind database. The MOVE statement causes the data and log file to be restored to the specified locations. The RESTORE FILELISTONLY statement is used to determine the number and names of the files in the database being restored. The new copy of the database is named TestDB. For more information, see RESTORE FILELISTONLY.

Step1.

BACKUP DATABASE Northwind
   TO DISK = 'c:\Northwind.bak'  

Step2.
--now copy that Backupfile and paste at the target machine


Step3.
RESTORE FILELISTONLY
   FROM DISK = 'c:\Northwind.bak'
-- When you run the above statement, it will give ou the logical names, make a note of those names

Step4.
RESTORE DATABASE TestDB
   FROM DISK = 'c:\Northwind.bak'
   WITH MOVE 'Northwind' TO 'c:\test\testdb.mdf',      --- 'Northwind' is the logical name of the MDF file
   MOVE 'Northwind_log' TO 'c:\test\testdb.ldf'            -- 'Northwind_Log' is the logical name of the LDF file

0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
3canAuthor Commented:
Sorry forgot mention I am using:

SQL Server management studio express.

I also only need to copy certian categories from one database.
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
oops , i thought you want 2 move the entire db , In case you just need to move few tables, you must follow the instructions "JaiGanesh" mentioned.
0
 
Jai STech ArchCommented:
open management studio(SSMS)
--> select the database --> right click --> Export
the export wizard will be opened...
click next
select the source database (from which you want to export your data)
next
select the destination database(to where you want to export)
select the tables you want to export...
complete the wizard...
you data are transfered.

:-)))
0
 
3canAuthor Commented:
JaiGanesh

Dont know if I am being dumb but when I right on the db I only get the following options:
New Database
New Query
Script Database
Tasks
Rename
Delete
Refresh
Properties

When browsing help I found the following command:

bcp Utility

bcp AdventureWorks.Sales.Currency out "Currency Types.dat"

Does this sound like a command I could ?

??


0
 
Jai STech ArchCommented:
under tasks --> you have EXPORT DATA
(i must have been more clear)
0
 
3canAuthor Commented:
From Taksk it goes:

detach
shrink
restore
backup
generate scripts
0
 
Jai STech ArchCommented:
iam afraid
SQL Server management studio express
does not have the option...
i ma using SSMS - Developer and I have the menus listed...around 10 of them
0
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now