PC Review


Reply
Thread Tools Rate Thread

Check for existence of server

 
 
Earl
Guest
Posts: n/a
 
      3rd Jan 2007
Is there any sort of check that can be done to see if a particular instance
of SQL Server is present? I already call a method to check for connection --
if no connection, I have the user re-enter server settings (server name and
database name). But the connection check is made by calling for a scalar
value in the database. What I'd rather do is graduate the error messages:

1. No server installed
2. Specified database name not installed
3. Specfied table or sproc not available

Any thoughts?


 
Reply With Quote
 
 
 
 
Uri Dimant
Guest
Posts: n/a
 
      3rd Jan 2007
Earl
1) if not exists (select * from sysservers where svrname ='blblb')
print 'Server does not exist'

2) if not exists (select * from sysdatabases where name ='blblb')
print Database does not exist'

3) if object_id('test') is null
print 'An object does not exist'

"Earl" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Is there any sort of check that can be done to see if a particular
> instance of SQL Server is present? I already call a method to check for
> connection -- if no connection, I have the user re-enter server settings
> (server name and database name). But the connection check is made by
> calling for a scalar value in the database. What I'd rather do is graduate
> the error messages:
>
> 1. No server installed
> 2. Specified database name not installed
> 3. Specfied table or sproc not available
>
> Any thoughts?
>



 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      3rd Jan 2007
Sure as shown on page 565, you can use the dbProviderFactories.GetFactory
method to return a list of (visible) servers based on a specific provider.
These same classes can be used to start, stop or pause the server service as
well (in addition to others).

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Earl" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Is there any sort of check that can be done to see if a particular
> instance of SQL Server is present? I already call a method to check for
> connection -- if no connection, I have the user re-enter server settings
> (server name and database name). But the connection check is made by
> calling for a scalar value in the database. What I'd rather do is graduate
> the error messages:
>
> 1. No server installed
> 2. Specified database name not installed
> 3. Specfied table or sproc not available
>
> Any thoughts?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check for existence of server Earl Microsoft ADO .NET 2 3rd Jan 2007 06:37 PM
Check for existence =?Utf-8?B?Q1dpbGxpcw==?= Microsoft Excel Misc 3 31st May 2006 01:20 PM
VBA to check for existence of a DSN =?Utf-8?B?R1BP?= Microsoft Excel Programming 2 29th May 2006 05:22 AM
Is it possible to check the existence of a URL in asp.net? TaeHo Yoo Microsoft ASP .NET 3 20th Oct 2003 10:14 PM
Is it possible to check the existence of a URL in asp.net? Leon Microsoft ASP .NET 1 18th Oct 2003 12:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:24 AM.