/****** Object: StoredProcedure [dbo].[CreateDbLink] Script Date: 10/25/2012 08:35:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[CreateDbLink]
As
Begin
EXEC sp_droplinkedsrvlogin 'TADER',Null
EXEC sp_dropserver 'TADER'
EXEC sp_addlinkedserver 'TADER','','SQLOLEDB','192.168.0.130'
EXEC sp_addlinkedsrvlogin 'TADER','false',null,'sa','1'
End
执行完这个存储过程后,将在SQL Server的“链接服务器”中创建一个名字叫“TADER”的“链接服务器”