EXEC sp_addlinkedserver @server='cqq',--被訪問的服務器別名(習慣上直接使用目標服務器IP,或取個別名如:JOY) @srvproduct='ms', @provider='SQLOLEDB', @datasrc='172.18.5.9' --要訪問的服務器 EXEC sp_addlinkedsrvlogin @rmtsrvname='cqq', --被訪問的服務器別名(若是上面sp_addlinkedserver中使用別名JOY,則這裏也是JOY) @useself='false', @locallogin=NULL, @rmtuser='sa', --賬號 @rmtpassword='sa' --密碼 SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TRIGGER [dbo].[INSERT_ABVOD_a] ON [dbo].[a] AFTER INSERT AS BEGIN INSERT INTO cqq.B.dbo.a SELECT * FROM inserted delete from a FROM inserted END go exec sp_dropserver 'cqq','droplogins'