3can
asked on
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.
An "SQL for dummies" type explanation would be very much appreciated.
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.
--> 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.
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
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
ASKER
Sorry forgot mention I am using:
SQL Server management studio express.
I also only need to copy certian categories from one database.
SQL Server management studio express.
I also only need to copy certian categories from one database.
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.
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.
:-)))
--> 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.
:-)))
ASKER
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.Curre ncy out "Currency Types.dat"
Does this sound like a command I could ?
??
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.Curre
Does this sound like a command I could ?
??
under tasks --> you have EXPORT DATA
(i must have been more clear)
(i must have been more clear)
ASKER
From Taksk it goes:
detach
shrink
restore
backup
generate scripts
detach
shrink
restore
backup
generate scripts
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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.