Programatically figuring out if sql server 2000 or 2005

G

Guest

Hi,

Is there a way to programatically tell whether I am connecting to a sql
server 2000 or sql server 2005 database. I have a connection string that
works for both versions, but when I connect to the database is there some way
to find out what version it is?

Thanks,
Matt
 
W

William \(Bill\) Vaughn

IIRC it's SELECT @@Version
SS 2005 is version 9. something and 2000 is version 8. something. You can
also use the factory classes to enumerate this value from the metadata.

--
____________________________________
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.
__________________________________
 
S

Sericinus hunter

Jaffa said:
Hi,

Is there a way to programatically tell whether I am connecting to a sql
server 2000 or sql server 2005 database. I have a connection string that
works for both versions, but when I connect to the database is there some way
to find out what version it is?

There is a system stored procedure sp_server_info which you can call
programatically. With parameter 500 it will return a row with version.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top