home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,935 of 19,505   
   migurus to All   
   pitfalls of accessing linked server over   
   20 Aug 13 18:31:51   
   
   From: migurus@yahoo.com   
      
   I am planning on accessing remote server from the stored procedure   
   --   
   CREATE PROCEDURE [dbo].[GetSTatus]   
           -- input parameters   
           @CUST_ID        int,   
           @VALID_DATE     date,   
           -- output parameter:   
           --      0 = NOT Valid   
           --      1 = Valid   
           @STATUS         int OUTPUT   
   AS   
   BEGIN   
      
   SET NOCOUNT ON;   
   BEGIN TRY   
           set @STATUS =   
           case   
                   when exists   
                   (   
                           select 1   
                           from    remoteserver.dbname.dbo.tblname   
                           where   Cust_Id = @CUST_ID   
                           and     Fr_Date <= @VALID_DATE   
                           and     To_Date >= @VALID_DATE   
                   )   
                   then 1   
                   else 0   
           end   
      
   END TRY   
      
   BEGIN CATCH   
           set @STATUS = 0;   
   END CATCH   
      
   END   
      
   --   
   The WAN is over stable dedicated circuit, but I'd like to hear what are   
   potential problems here, any suggestions on how to code for those situations.   
      
   The query will be fired with customer calling in for status, if remote server   
   is not available for whatever reason I need the application to get 0.   
      
   I'd like to make sure that any network related issues will not hung the   
   application.   
      
      
   Any suggestions are welcome.   
   Thanks in advance,   
   migurus   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca