|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Programatically figuring out if sql server 2000 or 2005Hi,
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 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. -- Show quote____________________________________ 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. __________________________________ "Jaffa" <Ja***@discussions.microsoft.com> wrote in message news:B6EB2BDD-98F9-450D-841A-F46FB01EDDC7@microsoft.com... > 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 Jaffa wrote:
> Hi, There is a system stored procedure sp_server_info which you can call> > 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? programatically. With parameter 500 it will return a row with version. Thanks a bunch, both methods in the previous posts work.
Show quote "Jaffa" wrote: > 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 |
|||||||||||||||||||||||