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)
 copying a table from one database to another

Author  Topic 

sureshprabhu
Starting Member

32 Posts

Posted - 2007-11-27 : 09:42:37
how can I copy a table and its contents(data) from one database to another database?

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2007-11-27 : 09:49:58
quote:
Originally posted by sureshprabhu

how can I copy a table and its contents(data) from one database to another database?



use export/import wizard.
Go to Top of Page

suresha_b
Yak Posting Veteran

82 Posts

Posted - 2007-11-27 : 09:50:49
Right click on the database, select Tasks, then select Export Data...

Suresh B.
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-11-27 : 09:51:34
Use the export wizard by right clicking the database name and clicking tasks and then export data. Select your source and target and then choose copy one or more tables, select the table you want to export and wallah.



Future guru in the making.
Go to Top of Page

sureshprabhu
Starting Member

32 Posts

Posted - 2007-11-27 : 10:05:19
i am using sqlserver 2005, there is no export/import option on right click on database, is there any other suggestions?
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-11-27 : 10:07:03
quote:
Originally posted by sureshprabhu

i am using sqlserver 2005, there is no export/import option on right click on database, is there any other suggestions?



Did you read my post? Right click on the database name in SSMS, choose tasks then choose export data. This will launch the wizard.



Future guru in the making.
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-11-27 : 10:12:16
If you don't see it, you must be using SQL Server 2005 Express which does not have SSIS thus no import/export functionality. If that is the case you will need to script the table as CREATE and then create it in the other database, then you can link the other database as a linked server and do a SELECT INTO to copy the data over.




Future guru in the making.
Go to Top of Page

sureshprabhu
Starting Member

32 Posts

Posted - 2007-11-27 : 10:17:55
ok..zoroaster! thanks for your reply, but, i didnt find that in my SSMSE.
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-11-27 : 10:19:15
quote:
Originally posted by sureshprabhu

ok..zoroaster! thanks for your reply, but, i didnt find that in my SSMSE.


Right, please read my post above - SSMSE does not have SSIS included which is used for import/export. You will need to take my second suggestion of using SP_ADDLINKEDSERVER to add a linked server to the other DB and then build the INSERT INTO... script referencing the table in the linked server using the proper fully qualified name: <servername>.<databasename>.<schemaowner>.<tablename>





Future guru in the making.
Go to Top of Page
   

- Advertisement -