Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 table wih data one DB to another D

Author  Topic 

ssmani84
Starting Member

20 Posts

Posted - 2010-02-25 : 01:00:39

hi to All,

how to copy the table wih data one DB to another Db

pls help me


i tried some way but its only copy the table fields only

ssmaniyadav

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-02-25 : 01:48:31
SELECT * INTO DB1.dbo.newtablename FROM DB2.tablename
or you can use if there is an existing table
INSERT INTO DB1.dbo.existingtable
SELECT * FROM DB2.tablename

Vabhav T
Go to Top of Page

ssmani84
Starting Member

20 Posts

Posted - 2010-02-25 : 02:10:49
Thanks vaibhav thanka a lot

ssmaniyadav
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-25 : 02:24:04
Note that that will get you Identity column (if one exists in the source table) and a Primary Key (ditto).

It will NOT get you any Secondary indexes, Foreign keys, Constraints (I think??), or Triggers. For those you will have to make scripts on the Source DB and execute them on the Destination DB
Go to Top of Page
   

- Advertisement -