Check if SQL Server Client Is Installed
It can be gotten through req query
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft /f Native*Client /k
result
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Native Client 11.0
End of search: 1 match(es) found.
then you can get exact number by parsing, for example, in python
import os
import re
os.system("reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft /f Native*Client /k > C:\\reg.out")
out=open("C:\\reg.out").read()
ver=re.search("Native Client (\d+)").group(1)
print(ver)
And you get ver=11
There is also faster way
code = os.system("reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft /f Native*Client*11 /k > null")
code == 0 # means there is client of version 11
code == 1 # means there is no such client
This can be found by running odbcad32.exe
.
From the Microsoft Support site:
To determine the version of SQL Server Native Client, use one of the following methods:
Method 1: On the system where you want to find the version of Native Client, start the ODBC Administrator (
odbcad32.exe
), and then check the Version column under the Drivers tab.
On 64-bit systems, also check odbcad64.exe
.
Go to->Run->cmd->type regedit.exe and you see the registry under the ODBC folder:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\
ODBC Drivers\SQL Server
I also find a complete answer about this issue, (based on MySQL, but basically is the same thing).
Edit later: according to your comment you have installed the 2005 version of SQL Server:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Microsoft SQL Native Client\CurrentVersion
Anyway I also show you how you can see the 2008 version to see the differences between the two versions.
For SQL Server 2008/R2:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Microsoft SQL Server\SQLNCLI10\CurrentVersion
For SQL Server 2012:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Microsoft SQL Server\SQLNCLI11\CurrentVersion