Determine version of SQL Server from ADO.NET

后端 未结 5 1342
难免孤独
难免孤独 2021-01-01 19:42

I need to determine the version of SQL Server (2000, 2005 or 2008 in this particular case) that a connection string connects a C# console application (.NET 2.0). Can anyone

5条回答
  •  -上瘾入骨i
    2021-01-01 19:56

    Run this script from a normal SqlCommand - it's quite extensive and useful!

    SELECT  
        SERVERPROPERTY('productversion') as 'Product Version', 
        SERVERPROPERTY('productlevel') as 'Patch Level',  
        SERVERPROPERTY('edition') as 'Product Edition',
        SERVERPROPERTY('buildclrversion') as 'CLR Version',
        SERVERPROPERTY('collation') as 'Default Collation',
        SERVERPROPERTY('instancename') as 'Instance',
        SERVERPROPERTY('lcid') as 'LCID',
        SERVERPROPERTY('servername') as 'Server Name'
    

    Marc

提交回复
热议问题