Friday, May 27, 2011

How to copy a table from one server to other in SQL Server

Well , there are like 100 ways to do this. But still people face problems in them. I am talking this specific to SQL Server.

CASE 1- You know the admin or sa password of the source server, then you can use SQL Server Import And Export Wizard, which is pretty simple. Here is the explanation, How to: Run the SQL Server Import and Export Wizard

CASE 2-If you don't have sysadmin rights, then the best option is first to create a Linked Server, stackunderflow: How to run a query on Linked Server

And then when you have created the Linked Server, suppose you want to copy a table (with data) PURCHASE_ORDER from your Linked Server (say NVIDIA) and schema (demo) to your local server with schema (demo), use the following query.

SELECT * INTO PURCHASE_ORDER FROM [NVIDIA ].[demo].[dbo].[PURCHASE_ORDER]
GO

No comments:

Post a Comment