• One way is to extract from @@VERSION.
  • Another way is to use exec master..xp_cmdshell ’systeminfo’
  • One more way will be to use a CLR Function (or stored procedure). Sample below:

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
 
public partial class UserDefinedFunctions
{
    [Microsoft.SqlServer.Server.SqlFunction]
    public static SqlString Function1()
    {
        return new SqlString(System.Environment.OSVersion.ToString());
    }
};

It should output something like this:

SELECT dbo.Function1()

>> Microsoft Windows NT 6.0.6001 Service Pack 1

VN:F [1.1.6_502]
Rating: 5.0/5 (1 vote cast)
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • LinkedIn
  • Live
  • MySpace
  • StumbleUpon
  • Technorati

Related posts:

  1. Get server information from the url of website
  2. Write your first SQL Server CLR Stored Procedure
  3. SQL Server 2008 is Ready!
  4. Connect to Microsoft SQL Server from Java
  5. Microsoft SQL Server 2008 Reporting Services released