SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

how to test connectivity for a linked server

By Chris Morton, 2007/10/29

Total article views: 734 | Views in the last 30 days: 12

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 its self

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


By Chris Morton, 2007/10/29

Total article views: 734 | Views in the last 30 days: 12
Your response
 
 
Related tags

Miscellaneous    
 
Like this? Try these...
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com