/****** 对象: LinkedServer [ETV2_LINK] 脚本日期: 09/08/2010 17:36:11 ******/
EXEC master.dbo.sp_addlinkedserver @server = N'ETV2_LINK', @srvproduct=N'ETV2_LINK', @provider=N'SQLNCLI', @datasrc=N'BWA035\BWA035_2K5'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'rpc', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'rpc out', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'collation name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'ETV2_LINK', @optname=N'use remote collation', @optvalue=N'true'
--查询远程DB表TableName
select * from ETV2_LINK.[etV2_Online].dbo.VisiteLog_20100629
--注意:是sys.objects不是sysobjects
--判断远程用户是否存在某张表
IF EXISTS (SELECT * FROM ETV2_LINK.[etV2_Online].sys.objects WHERE name = N'VisiteLog_20100629' AND type in (N'U'))
BEGIN
--逻辑处理
print '存在表'
END