SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 copying a table from one database to another
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sureshprabhu
Starting Member

32 Posts

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

sodeep
Flowing Fount of Yak Knowledge

USA
7174 Posts

Posted - 11/27/2007 :  09:49:58  Show Profile  Reply with Quote
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

India
82 Posts

Posted - 11/27/2007 :  09:50:49  Show Profile  Send suresha_b a Yahoo! Message  Reply with Quote
Right click on the database, select Tasks, then select Export Data...

Suresh B.
Go to Top of Page

Zoroaster
Aged Yak Warrior

USA
702 Posts

Posted - 11/27/2007 :  09:51:34  Show Profile  Reply with Quote
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 - 11/27/2007 :  10:05:19  Show Profile  Reply with Quote
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

USA
702 Posts

Posted - 11/27/2007 :  10:07:03  Show Profile  Reply with Quote
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

USA
702 Posts

Posted - 11/27/2007 :  10:12:16  Show Profile  Reply with Quote
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 - 11/27/2007 :  10:17:55  Show Profile  Reply with Quote
ok..zoroaster! thanks for your reply, but, i didnt find that in my SSMSE.
Go to Top of Page

Zoroaster
Aged Yak Warrior

USA
702 Posts

Posted - 11/27/2007 :  10:19:15  Show Profile  Reply with Quote
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.

Edited by - Zoroaster on 11/27/2007 11:14:48
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000