The SERVERPROPERTY function is a built-in function that returns information about the instance of SQL Server. This function was first introduced in SQL Server 2005 and enhanced in SQL Server 2016.
This article discusses how to use the SERVERPROPERTY function to return information about the current instance of SQL Server.
Usage:
The SERVERPROPERTY function can be used to return information about the following properties:
Edition – Returns the edition of SQL Server
IsCaseSensitive – Specifies whether the database engine installation is case-sensitive
IsClustered – Specifies whether the instance of SQL Server is a clustered instance
IsFullTextInstalled – Specifies whether full-text search is installed
IsIntegratedSecurityOnly – Specifies whether only integrated security is enabled
IsSingleUser – Specifies whether the database engine is running in single-user mode
Version – Returns the version of SQL Server
Example:
The following example uses the SERVERPROPERTY function to return information about the current instance of SQL Server.
SELECT SERVERPROPERTY(‘Edition’) AS Edition,
SERVERPROPERTY(‘IsCaseSensitive’) AS IsCaseSensitive,
SERVERPROPERTY(‘IsClustered’) AS IsClustered,
SERVERPROPERTY(‘IsFullTextInstalled’) AS IsFullTextInstalled,
SERVERPROPERTY(‘IsIntegratedSecurityOnly’) AS IsIntegratedSecurityOnly,
SERVERPROPERTY(‘IsSingleUser’) AS IsSingleUser,
SERVERPROPERTY(‘Version’) AS Version;
GO
This returns the following results:
Edition IsCaseSensitive IsClustered IsFullTextInstalled IsIntegratedSecurityOnly IsSingleUser Version
SQL Server 2016 Standard Edition (64-bit) 0 0 1 1 0 13.0.1601.5 (1 row(s) affected)
As you can see from the results, the SERVERPROPERTY function can be used to return a variety of information about the current instance of SQL Server.
The SERVERPROPERTY function is a built-in function that returns information about the instance of SQL Server. This function was first introduced in SQL Server 2005 and enhanced in SQL Server 2016. The SERVERPROPERTY function can be used to return information about the following properties: Edition, IsCaseSensitive, IsClustered, IsFullTextInstalled, IsIntegratedSecurityOnly, IsSingleUser, and Version.
SQL Server 2016 adds the following new properties that can be returned by the SERVERPROPERTY function:
Collation – Returns the collation of the instance of SQL Server
ComputerNamePhysicalNetBIOS – Returns the NetBIOS name of the computer on which the instance of SQL Server is running
ProcessorCount – Returns the number of processors that are available to the instance of SQL Server
ProductLevel – Returns the product level of the instance of SQL Server
ProductUpdateLevel – Returns information about whether any updates have been applied to the instance of SQL Server since it was installed
ProductVersion – Returns the major, minor, and build numbers for the instance of SQL Server
The following example uses the SERVERPROPERTY function to return information about the Collation, ComputerNamePhysicalNetBIOS, ProcessorCount, ProductLevel, ProductUpdateLevel, and ProductVersion properties.
SELECT SERVERPROPERTY(‘Collation’) AS Collation,
SERVERPROPERTY(‘ComputerNamePhysicalNetBIOS’) AS ComputerNamePhysicalNetBIOS,
SERVERPROPERTY(‘ProcessorCount’) AS ProcessorCount,
SERVERPROPERTY(‘ProductLevel’) AS ProductLevel,
SERVERPROPERTY(‘ProductUpdateLevel’) AS ProductUpdateLevel,
SERVERPROPERTY(‘ProductVersion’) AS ProductVersion;
GO
This returns the following results:
Collation ComputerNamePhysicalNetBIOS ProcessorCount ProductLevel ProductUpdateLevel ProductVersion
SQL_Latin1_General_CP1_CI_AS WIN-6ELGIUDSCJ4 4 RTM 0.0 13.0.1601.5 (1 row(s) affected)
As you can see from the results, the SERVERPROPERTY function can be used to return a variety of information about an instance of SQL Server.
FAQs:
Q: What is the syntax for the SERVERPROPERTY function?
A: The syntax for the SERVERPROPERTY function is as follows:
SERVERPROPERTY(property)
Property is the name of the property to return information about. For a complete list of properties that can be returned by the SERVERPROPERTY function, see the “Properties” section below.
Q: How can I use the SERVERPROPERTY function to return information about my instance of SQL Server?
A: You can use the SERVERPROPERTY function to return information about your instance of SQL Server by specifying one of the following property names: Edition, IsCaseSensitive, IsClustered, IsFullTextInstalled, IsIntegratedSecurityOnly, IsSingleUser, and Version. For a complete list of properties that can be returned by the SERVERPROPERTY function, see the “Properties” section below.
Q: What is the data type of the results returned by the SERVERPROPERTY function?
A: The data type of the results returned by the SERVERPROPERTY function is NVARCHAR(128).
Conclusion:
The SERVERPROPERTY function is a built-in function that can be used to return information about an instance of SQL Server. This function takes a single argument – the name of the property to return information about – and returns the value of that property. The data type of the results returned by the SERVERPROPERTY function is NVARCHAR(128). Some of the properties that can be returned by this function include Edition, IsCaseSensitive, IsClustered, IsFullTextInstalled, IsIntegratedSecurityOnly, IsSingleUser, Version, Collation, ComputerNamePhysicalNetBIOS, ProcessorCount, ProductLevel, ProductUpdateLevel, and ProductVersion.