473,667 Members | 2,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Recognizing if SQL Server is installed (and what version)

Hello,

I have an application which I'd like to determine if SQL Server is
installed, and if so, what version. Is there any way to do this outside of
error trapping?

Thanks!
Rick
Oct 17 '06 #1
9 19689
Not sure if it will work, but you could scan the registry, or even
search harddrive for the exe. It would probably be quicker to to just
use error checking though.

Just my 2 cents,

Seth Rowe
Rico wrote:
Hello,

I have an application which I'd like to determine if SQL Server is
installed, and if so, what version. Is there any way to do this outside of
error trapping?

Thanks!
Rick
Oct 17 '06 #2
Try to connect with a sqlconnection to (local) using integrated security
If it fails to connect, it is not installed, or the current user has no
rights to connect (check error).
If it is connected, you can read the version from the ServerVersion
property.

Rico wrote:
Hello,

I have an application which I'd like to determine if SQL Server is
installed, and if so, what version. Is there any way to do this outside of
error trapping?

Thanks!
Rick

Oct 19 '06 #3
This is probably the only "prpper" way to do this. Unfortunately, the
OP said he didn't want to do any error trapping (which I assumed meant
he didn't want to try to connect to the server) - but I say "to bad!"
:-)

Thanks,

Seth Rowe
Theo Verweij wrote:
Try to connect with a sqlconnection to (local) using integrated security
If it fails to connect, it is not installed, or the current user has no
rights to connect (check error).
If it is connected, you can read the version from the ServerVersion
property.

Rico wrote:
Hello,

I have an application which I'd like to determine if SQL Server is
installed, and if so, what version. Is there any way to do this outside of
error trapping?

Thanks!
Rick
Oct 19 '06 #4
I never understand the questions where the "programmer " doesn't want to
use exception handling. I always wander what such applications look like
(and how they work) ....

rowe_newsgroups wrote:
This is probably the only "prpper" way to do this. Unfortunately, the
OP said he didn't want to do any error trapping (which I assumed meant
he didn't want to try to connect to the server) - but I say "to bad!"
:-)

Thanks,

Seth Rowe
Theo Verweij wrote:
>Try to connect with a sqlconnection to (local) using integrated security
If it fails to connect, it is not installed, or the current user has no
rights to connect (check error).
If it is connected, you can read the version from the ServerVersion
property.

Rico wrote:
>>Hello,

I have an application which I'd like to determine if SQL Server is
installed, and if so, what version. Is there any way to do this outside of
error trapping?

Thanks!
Rick

Oct 19 '06 #5
Dear Rick,

To check if SQL Server is installed, you can check if this registry key
exists: HKEY_LOCAL_MACH INE\SOFTWARE\MI CROSOFT\Microso ft SQL Server

For the version, I'm not sure since I don't have different versions of
SQL Server installed.
On my computer, the registry path
HKEY_LOCAL_MACH INE\SOFTWARE\MI CROSOFT\Microso ft SQL
Server\80\Tools \Client Setup\Current Version
exists. In this key, you can read the string "CurrentVersion ". In my
case it's 8.00.194.

Best Regards,

HKSHK
Oct 19 '06 #6
The only reason is to avoid them is because try catch statements can
add a lot of overhead if used excessively.

Thanks,

Seth Rowe
Theo Verweij wrote:
I never understand the questions where the "programmer " doesn't want to
use exception handling. I always wander what such applications look like
(and how they work) ....

rowe_newsgroups wrote:
This is probably the only "prpper" way to do this. Unfortunately, the
OP said he didn't want to do any error trapping (which I assumed meant
he didn't want to try to connect to the server) - but I say "to bad!"
:-)

Thanks,

Seth Rowe
Theo Verweij wrote:
Try to connect with a sqlconnection to (local) using integrated security
If it fails to connect, it is not installed, or the current user has no
rights to connect (check error).
If it is connected, you can read the version from the ServerVersion
property.

Rico wrote:
Hello,

I have an application which I'd like to determine if SQL Server is
installed, and if so, what version. Is there any way to do this outside of
error trapping?

Thanks!
Rick

Oct 19 '06 #7
Agreed.

You only use these constructions when needed.
It is better to avoid exceptions where possible, by doing the proper
checks before executing the statements. But there will always be
exceptions in a program that must be handled.

The problem I detect in the question of Rick, is that he is using the
word "Error trapping", instead of exception handling; an exception is
not always an error.

The problem with another way of SQL Server checking(like the registry
way provided in the reply of HKSHK) is that the registry entries are
changing when new versions of SQL Server are released; SQL 2000 version
is stored in Microsoft SQL Server\80, SQL 2005 in Microsoft SQL
Server\90, SQL 7 in Microsoft SQL Server\70, SQL 6.5 - I don't know. And
maybe the next version will use a complete other path, or even no
registry settings at all. Another problem is that you may know that it
is installed, and what version it is, but if you don't know if it is
running (or if the user has the right to connect to it) you still have
to apply a try catch block to a connection to this instance.
rowe_newsgroups wrote:
The only reason is to avoid them is because try catch statements can
add a lot of overhead if used excessively.

Thanks,

Seth Rowe
Theo Verweij wrote:
>I never understand the questions where the "programmer " doesn't want to
use exception handling. I always wander what such applications look like
(and how they work) ....

rowe_newsgroup s wrote:
>>This is probably the only "prpper" way to do this. Unfortunately, the
OP said he didn't want to do any error trapping (which I assumed meant
he didn't want to try to connect to the server) - but I say "to bad!"
:-)

Thanks,

Seth Rowe
Theo Verweij wrote:
Try to connect with a sqlconnection to (local) using integrated security
If it fails to connect, it is not installed, or the current user has no
rights to connect (check error).
If it is connected, you can read the version from the ServerVersion
property.

Rico wrote:
Hello,
>
I have an application which I'd like to determine if SQL Server is
installed , and if so, what version. Is there any way to do this outside of
error trapping?
>
Thanks!
Rick
>
>
Oct 20 '06 #8

Rico napisal(a):
Hello,

I have an application which I'd like to determine if SQL Server is
installed, and if so, what version. Is there any way to do this outside of
error trapping?

Thanks!
Rick
Hi, i use this code to check about running instances, which can also
provide information about version. I know it's not 100% what you
looking for, but perhaps will be useful:
Imports System.Data.Sql
Public class test
Private _list_inst As SqlDataSourceEn umerator

Public Property list_inst() As SqlDataSourceEn umerator
Get
Return _list_inst
End Get
Set(ByVal value As SqlDataSourceEn umerator)
_list_inst = value
End Set
End Property

Private Function listservers() As DataTable
list_inst = Sql.SqlDataSour ceEnumerator.In stance
Return list_inst.GetDa taSources
End Function
end class

Function listservers return datatable with current installed and
running (!) instances. There is column called version.

Greeting
PK

Oct 26 '06 #9
Rico,

Execute this select statement:
SELECT @@VERSION

Cheers,
Rob Panosh

Rico wrote:
Hello,

I have an application which I'd like to determine if SQL Server is
installed, and if so, what version. Is there any way to do this outside of
error trapping?

Thanks!
Rick
Oct 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5404
by: RWC | last post by:
Hi Folks, I'm looking for a way to determine if the client machine has access installed and if so, what version. The reason I need this is to determine (programatically) if the Access Runtime is required to be installed and if not, which version of the program database needs to be installed with the current version of Access. (hope that makes sense). If anyonoe could point me in the right direction, I'd really appreciate it.
0
2528
by: Neil | last post by:
Hi I'm a non IT professional experimenting with web develepment on my PC. I have installed Visual Interdev 6 and downloaded SQL server 2000 to learn how to develop web application on my PC running Win XP Pro. I was previously developing using Frontpage 2002 and IIS 5.0 with some success but wanted to have a bash with Sql Server and Interdev. I have installed SQL Server 2000 and have got it running OK (I think).
6
673
by: JR | last post by:
My IIS Web site has a virtual directory called content mapped to a network share. If the home directory of the Web site is c:\inetpub\wwwroot and the virtual directory maps to the network share \\myserver\content, Server.MapPath is returning c:\inetpub\wwwroot\content rather than \\myserver\content. I've tried adding <identity impersonate="true" userName="name" password="password"/> to the web.config file in order to make sure the...
3
22883
by: Tim | last post by:
Hello, We do not run SQL Server in our shop, but I'm starting to be tasked with analyzing SQL Server databases from outside shops. I will need to open .MDF files sent to me. Can I do this using SQL Server 2005 Developer version? Or do we have to spring for the Workgroup version? Thanks, in advance, for your help. T
2
3137
by: thomas_vicker | last post by:
Hi, I need to maintain both SQL Server 2000 and 2005 on my PC for support purposes. I am using the developer additions. After I install everything (with no install errors) I can use SQL 2005 Mgt Studio fine until I bring up SQL 2000 Query Analyzer or Enterprise Mgr. After that, I cannot bring up SQL 2005 Mgt Studio. It get this message: Package 'Microsoft SQL Management Studio package' failed to load
16
2314
by: Jeremy S. | last post by:
I'm about to install VS.NET 2005 and SQL Server 2005 on a new/clean development machine (XP Pro/SP2 etc). Is the order of installation important (i.e., which product should I install first)? Thanks!
2
5847
by: | last post by:
I want to send email without Smtp Server. We have a Imail Server installed on our web server which requires Smtp server is not working on it. When i disable Smtp Server on the local machine Cdo Emails is not being sent ? how can i solve it ?
0
965
by: Sameera | last post by:
Hi, Could any one help me out on how to retriveing the supported formats for the installed Word version in C#. Thanks
0
8366
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8650
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.