July 6, 2005 at 1:35 pm
Using SQL 2000...
I need help with determining using SQL code if a link server is available. If it is, then the proc will continue on. If it is not, then it will send a message out letting the admin know it is not reachable. Can anyone give me some guidance on how I can do this through SQL code?
Thank you,
Carol
July 6, 2005 at 1:50 pm
Maybe something like this :
If exists (Select * from LinkedServer.DbName.dbo.TableName)
begin
--do what you need to do
end
if @@error > 0
begin
--linkedserver is down, raiserror...
end
but you could always do what you have to do and check for an error after the statement.. would save you a roundtrip to the linked server (I have one server that takes 5 secs just to connect).
July 6, 2005 at 1:56 pm
If I remember, right, though, doesn't this generate a sev 16 error if the linked server is unavailable (meaning it drops out of the batch and doesn't run anything else). We wanted to do something similar, verify servers were up but resorted to DTS. Basically the DTS has an ActiveX script that makes an ADO connection to the server. We can check the Connection state property to verify if a connection was successfully made. Maybe something like this would work for you.
K. Brian Kelley
@kbriankelley
July 6, 2005 at 2:06 pm
Don't know about the severity level... good point though. Maybe this is not a task to be handled in a proc.
July 6, 2005 at 2:07 pm
Hey how come I have question marks under my name while you have a nice(r) logo??
July 6, 2005 at 2:10 pm
Remi,
You can't check from TSQL the conectivity of a Linked Server because as Brian said above the batch will be suspended if an error occurs. The solution is DMO, ACTIVEX or A JOB that runs out of your current context
* Noel
July 6, 2005 at 2:12 pm
I won't agree on this one because that would be redundant . Thanx for the info.
July 6, 2005 at 2:12 pm
You can always update your AVATAR under the Account Profile
* Noel
July 6, 2005 at 2:13 pm
And here I'll agree with me
* Noel
July 6, 2005 at 2:22 pm
That's not it. The avatar is its tranformer logo, the rectangles is another logo (linked with post count/member status??).
July 6, 2005 at 2:25 pm
I was a guinea pig of Steve and Andy as they were transitioning to the messageboards. Somewhere along the line I get the graphic under my name. I like it a whole lot more than the question marks so I haven't complained.
K. Brian Kelley
@kbriankelley
July 6, 2005 at 2:40 pm
"guinea pig" : I'll keep the question marks on then... Anyways it's gonna switch to "carpal tunnel" in a few weeks so I'll forget it for a while .
July 6, 2005 at 2:41 pm
The rectagles are for MODERATORS
http://www.sqlservercentral.com/forums/images/rankimages/moderator.gif
do you want the rectangles or the AVATAR ?
* Noel
July 6, 2005 at 2:43 pm
I didn't want the "? ? ? ? ?"...
July 6, 2005 at 2:47 pm
I guess you will have to post this one on the Suggestions Forum
* Noel
Viewing 15 posts - 1 through 15 (of 26 total)
You must be logged in to reply to this topic. Login to reply