SQL Query to Insert records in Table from one SQL Server instance to another
Before proceeding with the insert logic make sure following points:
1. Make sure that the target SQL Server is added in sys.servers through SQL Query :
select * from sys.servers
2. if the target SQL Server is not in sys.servers you can add it by using sp_addlinkedserver stored procedure, Such as sp_addlinkedserver '<SEREVR NAME>'
Execute the following SQL Query:
INSERT INTO dbo.[TableName]
SELECT *
FROM [ServerNAme].[DataBaseName].dbo.[TableName]
update dbo.SalesTable
1. Make sure that the target SQL Server is added in sys.servers through SQL Query :
select * from sys.servers
2. if the target SQL Server is not in sys.servers you can add it by using sp_addlinkedserver stored procedure, Such as sp_addlinkedserver '<SEREVR NAME>'
Execute the following SQL Query:
INSERT INTO dbo.[TableName]
SELECT *
FROM [ServerNAme].[DataBaseName].dbo.[TableName]
Comments
Post a Comment