0

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.

5
  • Elaborate on "it is not working"? Are you linking from to a remote SQL server? Commented Feb 9, 2014 at 4:51
  • Take a look at this link... stackoverflow.com/questions/4091960/… Commented Feb 9, 2014 at 4:54
  • I get this error. Could not find server 'LETRAN' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers. How can I do that? Commented Feb 9, 2014 at 4:59
  • I under the impression... from your post that the linked server has already been created. Is that not correct? Commented Feb 9, 2014 at 5:03
  • I thought it was already linked, but when I executed your given codes, I get that error so I assume it is not yet linked. Commented Feb 9, 2014 at 5:05

3 Answers 3

1

try this.

INSERT INTO [E-SVR].[enrollmentCollege].[dbo].CDDT_MSTR (position_id)
SELECT position_id FROM [LETRAN].[enrollmentCollege].[dbo].CDDT_MSTR
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, but I think "LETRAN" server name is incorrect because I get this error.. "Could not find server 'LETRAN' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers. "
0

Try this.

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

Comments

0

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

3 Comments

I execute "select * from sys.servers" and get the server name "LETRAN" But, i still get this error.. "Could not find server 'LETRAN' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers. "
OK, have you linked this server?
I think not yet, I get this error. Could not find server 'LETRAN' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.