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
 General SQL Server Forums
 New to SQL Server Programming
 Copy Table data from ServerA to ServerB

Author  Topic 

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2010-10-28 : 02:52:05
Hi
Enviroment
ServerName - ServerA
ServerName - ServerB

Database
Insurance
Insurance

Existing Table in both servers and row count
dbo.Policy Rows Count 10000
dbo.Policy Rows Count 0

I Need to copy data from ServerA to ServerB using SQL Query

I tryed the below Query

Select * into ServerB.Insurance.dbo.Policy from ServerA.Insurance.dbo.Policy


does not works :(


Please help
Thanks in Advance

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-10-28 : 02:55:15
What did you mean by "dosn't work"? Have you setup a linked server?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2010-10-28 : 03:32:34
i have not set linked server.

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-10-28 : 03:36:23
Your "Existing Table in both servers and row count" implies that the Policy table already exists on ServerB, but is empty?

If so you cannot use SELECT * INTO ... as that requires that the target table does NOT exist.

If that is the case you can use

INSERT INTO ServerB.Insurance.dbo.Policy Select * from ServerA.Insurance.dbo.Policy

instead
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-10-28 : 03:37:19
"i have not set linked server."

Well that will be the problem then! Read the DOCs on Linked Server, create one, then try again
Go to Top of Page
   

- Advertisement -