Hi all,

i want to transfer data one sql database to another database in same sql server. i try to insert into table2 select * from table1 , but this query useful for same database, but i want to use different database, in same sql server.

help me here to solve this problem,

mrugesh

Recommended Answers

All 6 Replies

Use database backup.

This query copies the table "madExcept" from the "Bugs" database to the "ShotgunHill" database:

Select * Into ShotgunHill..madExcept From Bugs..madExcept

Doing this does not recreate the table properly in the destination database though. Many table constraints, such as Primary Key, will not be set up properly when you select into another table. You are better off to use backups/restore as adatapost mentioned.

This query copies the table "madExcept" from the "Bugs" database to the "ShotgunHill" database:

Select * Into ShotgunHill..madExcept From Bugs..madExcept

Doing this does not recreate the table properly in the destination database though. Many table constraints, such as Primary Key, will not be set up properly when you select into another table. You are better off to use backups/restore as adatapost mentioned.

Hi thr,

THANK YOU VERY MUCH TO GIEV RESPONSE, BUT I GET MY OLUTION BY MYSELF, AND MY APPLICATION WORK PROPERLY.

THANKS ONCE AGAIN.

MRUGESH

i want to transfer millions of records from Microst SQL To Another Microsoft SQL Provided with a Pause Button.When The Application Close .After the Application Open It Should Show Resume and transfer the Data

Use bulk copy, from microsoft, can be found in odbc reference api, dblib, ctlib etc, it comes in many forms, early version came as a command bcp, than dblib now is masked on top of odbc or oledb, just write some code in order to make a bulk copy, for me worked, 10 millions records in aprox. 1 minute

Use Backup of old DB and then restore it into new DB

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.