我在数据库中的一个表中加了个触发器,用来同步两个表的数据(两表结构一样),但是保存等速度变得很慢。
代码如下:
   create   trigger   SameClient   on   T_Client   
  for   insert,update,delete   
  as   
  set     XACT_ABORT   on   exec   master..xp_cmdshell   'isql   /S"xz"   /U"sa"   /P""   /q"exec   master..xp_cmdshell   ''net   start   msdtc'',no_output"',no_output   
exec   master..xp_cmdshell   'net   start   msdtc',no_output   BEGIN   DISTRIBUTED   TRANSACTION   
  delete   from   openrowset('sqloledb','computer1';'sa';'',DBTest.dbo.T_client)   
  where   F_AddressCode   in(select   F_AddressCode   from   deleted)   
  insert   into   openrowset('sqloledb','computer1';'sa';'',DBTest.dbo.T_client)   
  select   *   from   inserted   
  commit   tran   
go