Nozella
Nozella

Reputation: 11

Copy one table from a server to another server using query MS SQL

How can I copy a table to another server. It's a linked server. I used this code, but it is not working.

INSERT INTO [E-SVR].enrollmentCollege.CDDT_MSTR (position_id)
SELECT position_id FROM LETRAN.enrollmentCollege.CDDT_MSTR

Thank you.

Upvotes: 0

Views: 126

Answers (3)

Szymon
Szymon

Reputation: 43023

When you are using a 4-part name for a table (which you have to so to use a linked server as part of the name), you need to specify the schema (the 3rd part) as well:

INSERT INTO [E-SVR].enrollmentCollege.dbo.CDDT_MSTR (position_id)
SELECT position_id FROM LETRAN.enrollmentCollege.dbo.CDDT_MSTR

If you want to use the default schema, you can leave the schema part empty:

INSERT INTO [E-SVR].enrollmentCollege..CDDT_MSTR (position_id)
SELECT position_id FROM LETRAN.enrollmentCollege..CDDT_MSTR

Upvotes: 0

user3288802
user3288802

Reputation: 1

Try this.

INSERT INTO enrollmentCollege..CDDT_MSTR (position_id) SELECT position_id FROM LETRAN.enrollmentCollege..CDDT_MSTR

Upvotes: 0

user3277522
user3277522

Reputation: 96

try this.

INSERT INTO [E-SVR].[enrollmentCollege].[dbo].CDDT_MSTR (position_id)
SELECT position_id FROM [LETRAN].[enrollmentCollege].[dbo].CDDT_MSTR

Upvotes: 1

Related Questions