Hi i forgot to include this from my last post:
How to insert and update from remote linked server Created: 8/7/2007 1:10:01 AM
This script is part of that post but is also useful by itself.
This script test for connectivity to a linked server...
This code depends on:
USE [DIMSCONSOLIDATEDData]
GO
/****** Object: UserDefinedFunction [dbo].[General_FXN_Alias] Script Date: 08/07/2007 08:44:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- Create date:
-- Description:
-- =============================================
CREATE FUNCTION [dbo].[General_FXN_Alias]
(
@DistrictID int,
@Table varchar(50) = 'sysobjects'
)
RETURNS varchar(90)
AS
BEGIN
-- Declare the return variable here
-- Add the T-SQL statements to compute the return value here
RETURN (SELECT Alias from General_District where districtID = @districtID) + '.' + @Table
END
and
USE [DIMSCONSOLIDATEDData]
GO
/****** Object: Table [dbo].[General_Error_Log] Script Date: 08/07/2007 09:21:06 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[General_Error_Log](
[ErrorID] [bigint] IDENTITY(1,1) NOT NULL,
[ErrorMessage] [varchar](255) NULL,
[DateTime] [datetime] NOT NULL,
[Alias] [varchar](50) NOT NULL,
[Sproc] [varchar](50) NOT NULL,
[ErrorCode] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF