代码如下:–PK select * from sys.key_constraints where object_id = OBJECT_ID(‘TB’) –FK select * from sys.foreign_keys where parent_object_id =OBJECT_ID(‘TB’) –创建链接服务器 exec sp_addlinkedserver ‘ITSV ‘, ‘ ‘, ‘SQLOLEDB ‘, ‘远程服务器名或ip地址 ‘ exec sp_addlinkedsrvlog