I have two database servers
one is server name: X and other one is server name: Y
I have a table ABC
in both databases. I need to copy the data from X server, table ABC
to the Y server, table ABC
.
I tried this way its giving error.
INSERT INTO [X].Database.dbo.ABC SELECT * FROM [Y].Database.dbo.ABC
but I get this error:
Could not find server 'xxx.xxx.xxx.xxx' 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.
Open up SSMS and point it to Server Y. Right click on database ABC, Tasks -> Import Data. Follow the wizard and point it at your source data in Server X.
The error is telling you what to do. Use sp_addlinkedserver to create a linked server to the remote server. Then run the query.
First exec procedure:
EXEC sp_addlinkedserver
@server=N'Y',
@srvproduct=N'',
@provider=N'SQLNCLI',
@datasrc=N'Y\instance1';
Then run the query.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.