Open In App

SQL Server | SERVERPROPERTY()

Improve
Improve
Like Article
Like
Save
Share
Report

SQL Server provides a System Defined function SERVERPROPERTY(propertyname)

SERVERPROPERTY(): SERVERPROPERTY() function is used to return the information about different properties of system or so called the instance information. 

propertyname: This expression contains the information about property in question and returns the same. 

Following are few property names which SERVERPROPERTY() function provides information about. Apart from mentioned properties there are other properties too. 

1. MachineName: This property name is used as an argument in SERVERPROPERTY() function to find the name of the machine/computer on which SQL Server is running. 

Syntax: 
 

SELECT SERVERPROPERTY ('MachineName')

Example: 
 

Output: 
 

2. Edition: This property name is used an argument in SERVERPROPERTY() function to get the edition of SQL Server installed on machine/computer. 

Syntax: 
 

SELECT SERVERPROPERTY ('Edition')

Example: 
 

3. INSTANCEDEFAULTDATAPATH: This property name is used as an argument in SERVERPROPERTY() function to find the default path of the data files. 

Syntax: 
 

SELECT SERVERPROPERTY ('INSTANCEDEFAULTDATAPATH')

Example: 
 

4. INSTANCEDEFAULTLOGPATH: This property name is used as an argument in SERVERPROPERTY() function to find the default path of the log files. 

Syntax: 
 

SELECT SERVERPROPERTY ('INSTANCEDEFAULTLOGPATH')

Example: 
 

5. PRODUCTVERSION: This property name is used as an argument in SERVERPROPERTY() function to get the information about the version of product being used. 

Syntax: 
 

SELECT SERVERPROPERTY (' PRODUCTVERSION')

Example: 
 

6. BUILDCLRVERSION: This property name is used as an argument in SERVERPROPERTY() function to get the information about the version of the Microsoft .NET Framework Common Language Runtime (CLR). This framework was used for building the SQL Server instance. 

Syntax: 
 

SELECT SERVERPROPERTY ('BUILDCLRVERSION')

Example: 
 

7. PROCESSID: This property name is used as an argument in SERVERPROPERTY() function to get the Process ID of the SQL Server service. 

Syntax: 
 

SELECT SERVERPROPERTY ('PROCESSID')

Example: 
 

8. ResourceLastUpdateDateTime: This property name is used as an argument in SERVERPROPERTY() function to get the information about the last updates of the Resource Database i.e the Date and Time when the Resource Database was last updated on. 

Syntax: 
 

SELECT SERVERPROPERTY ('ResourceLastUpdateDateTime')

Example: 
 

9. EditionID: This property name is used as an argument in SERVERPROPERTY() function to find the Edition ID of the SQL Server being installed on computer/machine. 

Syntax: 
 

SELECT SERVERPROPERTY ('EditionID')

Example: 
 

10. Collation: This property name is used as an argument in SERVERPROPERTY() function to find the collation of the SQL Server being installed on computer/machine. 

Syntax:

select SERVERPROPERTY ('collation')

Example: 

Note: To get the information about other properties, refer Microsoft Docs.
 


Last Updated : 05 Aug, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads