How can I detect which version of sqlServer I am connected to using smo?

Hi,

I have a quick app to do few scripts and generate sps.However some stuff which is new to sql 2005 dont work in sql 2000 as not supported.

Basically. I choose a server from a combobox and connect to the database.

now at this point i need to know if I am running a sql 2005 server or 2000 .

Is there a call I can make is SMO to achieve this

thanks a lot in advance



Answer this question

How can I detect which version of sqlServer I am connected to using smo?

  • Dave M

    Ye, thats right, look at the properties of the version property, they will exose some other string like minor / major etc.

    But you are right 8 is SQL 2000 , 9 is SQL 2005

    HTH, Jens Suessmeyer.

    ---
    http://www.sqlserver2005.de
    ---


  • GamerJunky

    Thanks a lot.

    That worked.

    I have found out also about "VersionString" which gives me what I want quickly.

    I suppose "8.00.194". in particular "8" stands for Sql Server 2000

    and "9.00.1399". in particular "9" stands for Sql Server 2005

    Is this correct

    Thanks


  • RTIT

    Hi,

    try this one here:

    Microsoft.SqlServer.Management.Smo.Server _server = new Server(new ServerConnection(new SqlConnection("Data Source={0};Integrated Security=True")));

    //_server.Information.Version --Information can be found here


    HTH, Jens Suessmeyer

    ---
    http://www.sqlserver2005.de
    ---


  • How can I detect which version of sqlServer I am connected to using smo?