T-SQL has a very little known function called SERVERPROPERTY which provides a vast number of arguments that allow you to obtain tremendous amount of information about your SQL Server. The following is a list of my favorite propterties and the most requested by consultants, DBAs, and users alike:
Syntax
SERVERPROPERTY (propertyname)
Properties
- Collation: returns the name of the default collation being used on your SQL Server
- Edition: Installed product edition of the instance of SQL Server. Use the value of this property to determine the features and the limits, such as maximum number of CPUs, that are supported by the installed product.
Returns:
'Desktop Engine' (Not available for SQL Server 2005.)
'Developer Edition'
'Enterprise Edition'
'Enterprise Evaluation Edition'
'Personal Edition'(Not available for SQL Server 2005.)
'Standard Edition'
'Express Edition'
'Express Edition with Advanced Services'
'Workgroup Edition'
'Windows Embedded SQL' - EngineEdition: Database Engine edition of the instance of SQL Server installed on the server.
1 = Personal or Desktop Engine (Not available for SQL Server 2005.)
2 = Standard (This is returned for Standard and Workgroup.)
3 = Enterprise (This is returned for Enterprise, Enterprise Evaluation, and Developer.)
4 = Express (This is returned for Express, Express Edition with Advanced Services, and Windows Embedded SQL.) - InstanceName: Name of the instance to which the user is connected. Returns NULL if the instance name is the default instance, if the input is not valid, or error. In this case you may want to try using the ServerName property.
- IsIntegratedSecurityOnly: Server is in Integrated Security mode. I found this one particularly useful to troubleshoot SQL Server installations for GP, especially when the server has been 'accidentally' configured for Integrated Security instead of Mixed Mode.1 = Integrated security. 0 = Not Integrated security. NULL = Input is not valid, or an error.
- LicenseType: Mode of this instance of SQL Server.
PER_SEAT = Per Seat mode
PER_PROCESSOR = Per-processor mode
DISABLED = Licensing is disabled. - ProductVersion: Version of the instance of SQL Server, in the form of 'major.minor.build'. Can also be obtain with SELECT @@VERSION
- SQLSortOrderName: The SQL sort order name from the collation.
select serverproperty('Collation')
---------------------------------------------------------------------------
SQL_Latin1_General_CP1_CI_AS
select serverproperty('Edition')
---------------------------------------------------------------------------
Standard Edition
select serverproperty('EngineEdition')
---------------------------------------------------------------------------
2
select serverproperty('ServerName')
---------------------------------------------------------------------------
MGB001
select serverproperty('IsIntegratedSecurityOnly')
---------------------------------------------------------------------------
0
select serverproperty('LicenseType')
---------------------------------------------------------------------------
DISABLED
select serverproperty('ProductVersion')
---------------------------------------------------------------------------
9.00.3054.00
select serverproperty('SQLSortOrderName')
---------------------------------------------------------------------------
nocase_iso
I hope you find SERVERPROPERTY a very usefull function and the one stop shop for a bunch of information on SQL Server properties. If you would like the complete list of properties dont visit http://msdn.microsoft.com/en-us/library/ms174396.aspx or open SQL Server Books Online and type in SERVERPROPERTY in the Look For line.
Until next post!
MG.-
Mariano Gomez, MIS, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/
Comments