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 2008 Forums
 Other SQL Server 2008 Topics
 Copy table from one server to other

Author  Topic 

arvind_ramugade
Starting Member

30 Posts

Posted - 2011-12-16 : 02:02:22
Hi,
We are using SQl Server Standard edition (2008 R2)
We'd like to know is there any way to copy table from one SQL server database to another database in different SQL Server ?

Please let us know the procedure around this.

Thanks !
Arvind.

ramugade

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-12-16 : 02:08:53
Yes there are lots of methods that can do this. You might find the easiest way to do it is through the import/export wizard available in the right-click menus in SSMS.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-16 : 02:09:43
multiple options

1. Use export/import wizard and do table copy to new database
2. Create a linked server connection between servers from targetdb to sourcedb and use query like

USE [TargetDB]
SELECT * INTO TargetTable FROM [SourceLinkedServer].SourceDB.dbo.Table


3. use OPENROWSET and no need of linked server setup


USE [TargetDB]
SELECT * INTO TargetTable FROM OPENROWSET('SQLNCL1','Server=sourceserver;Trusted_Connection=yes;',
'SELECT * FROM SourceTable') AS a;


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

arvind_ramugade
Starting Member

30 Posts

Posted - 2011-12-21 : 04:03:00
How do I create a linked server connection between servers from targetdb to sourcedb ?

ramugade
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-21 : 11:55:27
quote:
Originally posted by arvind_ramugade

How do I create a linked server connection between servers from targetdb to sourcedb ?

ramugade


Two ways
either from SQL Management studio wizard by expanding Server->Server Objects->Linked Server. right click and choose add linked server to launch window to add the details like name,type.provider etc

If you want to do it using script have a look at sp_addlinkedserver procedure

http://msdn.microsoft.com/en-us/library/ms190479.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -