If you want to move the data from Server1 to Server2, then you need a connect to that server.
1) Create a link to Server2 link
2) Create a SYNONYM
CREATE SYNONYM myTable2 FOR
[Server2].[DataBase2].dbo.Table2;
3) Change your Query like this
INSERT INTO MyTable2(ID,InwardID,RetrievalID,UnitID,DepartmentID,DocumentType,
DocumentCriticality,AdditionalInfo1,AdditionalInfo2,AdditionalInfo3,DocAccRelated,AccountNumber,
CustomerName,TransactionDateFrom,TransactionDateTo,DocCategory,DocClosingDate,ProposedDestructionDate,
CheckerDestructionDate,
SuperCheckerDestructionDate,
DocumentStatusID,
DocumentName,
Location,
StorageVendor,
BoxBarcode,
IsRefiled,
ReinventoryStatus,
DateofDispatch,
AdditionalDispatchDetails,
FileBarcode,
InwardDate,
RetrievalDate,
LostStatus,
CreatedOn,
CreatedBy,
UpdatedOn,
UpdatedBy) ---- this is required otherwise will get error.
SELECT ID,InwardID,RetrievalID,UnitID,DepartmentID,DocumentType,
DocumentCriticality,AdditionalInfo1,AdditionalInfo2,AdditionalInfo3,DocAccRelated,AccountNumber,
CustomerName,TransactionDateFrom,TransactionDateTo,DocCategory,DocClosingDate,ProposedDestructionDate,
CheckerDestructionDate,
SuperCheckerDestructionDate,
DocumentStatusID,
DocumentName,
Location,
StorageVendor,
BoxBarcode,
IsRefiled,
ReinventoryStatus,
DateofDispatch,
AdditionalDispatchDetails,
FileBarcode,
InwardDate,
RetrievalDate,
LostStatus,
CreatedOn,
CreatedBy,
UpdatedOn,
UpdatedBy
from inserted
But i wont recommend using this kind of logic in the trigger. If you are using Store Procedure for
C.R.U.D operation, then i would suggest to bring this logic into a store Procedure.(If you need a immediate result)
If you just storing this information for logging purposes i would suggest the following:
1) Create a Log Dump table in Database1.
2) Create a SSIS package to move the data from Server1 to server 2 and Truncate the Dump Table in Database1.
3) Create a SQL JOB, link it with SSIS package, and Set the desired Interval.
Hope it helps.