Sunday, August 5, 2007

T-SQL serverProperty

Syntax
SERVERPROPERTY ( propertyname )
propertyname

Is an expression that contains the property information to be returned for the server. propertyname can be one of these values.

Property name Values returned

BuildClrVersion

Version of the Microsoft .NET Framework common language runtime (CLR) that was used while building the instance of SQL Server 2005.

Base data type: nvarchar(128).

Collation

Name of the default collation for the server.

NULL = Input is not valid, or an error.

Base data type: nvarchar(128)

CollationID

ID of the SQL Server collation.

Base data type: int

ComparisonStyle

Windows comparison style of the collation.

Base data type: int

ComputerNamePhysicalNetBIOS

NetBIOS name of the local computer on which the instance of SQL Server is currently running.

For a clustered instance of SQL Server on a failover cluster, this value changes as the instance of SQL Server fails over to other nodes in the failover cluster.

On a stand-alone instance of SQL Server, this value remains constant and returns the same value as the MachineName property.

Note:
If the instance of SQL Server is in a failover cluster and you want to obtain the name of the failover clustered instance, use the MachineName property.

NULL = Input is not valid, or an error.

Base data type: nvarchar(128)

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'

Base data type: nvarchar(128)

EditionID

Is an identification number that represents the installed product edition of the instance of SQL Server. Use the value of this property to determine features and limits, such as maximum number of CPUs that are supported by the installed product.

-1253826760 = Desktop Edition

-1592396055 = Express Edition

-1534726760 = Standard Edition

1333529388 = Workgroup Edition

1804890536 = Enterprise Edition

-323382091 = Personal Edition

-2117995310 = Developer Edition

610778273 = Enterprise Evaluation Edition

1044790755 = Windows Embedded SQL

4161255391 = Express Edition with Advanced Services

For more information, see Features Supported by the Editions of SQL Server 2005.

Base data type: int

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.)

Base data type: int

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.

Base data type: nvarchar(128)

IsClustered

Server instance is configured in a failover cluster.

1 = Clustered.

0 = Not Clustered.

NULL = Input is not valid, or an error.

Base data type: int

IsFullTextInstalled

The full-text component is installed with the current instance of SQL Server.

1 = Full-text is installed.

0 = Full-text is not installed.

NULL = Input is not valid, or an error.

Base data type: int

IsIntegratedSecurityOnly

Server is in integrated security mode.

1 = Integrated security.

0 = Not Integrated security.

NULL = Input is not valid, or an error.

Base data type: int

IsSingleUser

Server is in single-user mode.

1 = Single user.

0 = Not single user

NULL = Input is not valid, or an error.

Base data type: int

LCID

Windows locale identifier (LCID) of the collation.

Base data type: int

LicenseType

Mode of this instance of SQL Server.

PER_SEAT = Per Seat mode

PER_PROCESSOR = Per-processor mode

DISABLED = Licensing is disabled.

Base data type: nvarchar(128)

MachineName

Windows computer name on which the server instance is running.

For a clustered instance, an instance of SQL Server running on a virtual server on Microsoft Cluster Service, it returns the name of the virtual server.

NULL = Input is not valid, or an error.

Base data type: nvarchar(128)

NumLicenses

Number of client licenses registered for this instance of SQL Server if in Per Seat mode.

Number of processors licensed for this instance of SQL Server if in per-processor mode.

Returns NULL when the server is none of these.

Base data type: int

ProcessID

Process ID of the SQL Server service. ProcessID is useful in identifying which Sqlservr.exe belongs to this instance.

NULL = Input is not valid or an error.

Base data type: int

ProductVersion

Version of the instance of SQL Server, in the form of 'major.minor.build'.

Base data type: nvarchar(128)

ProductLevel

Level of the version of the instance of SQL Server.

Returns one of the following:

'RTM' = Original release version

'SPn' = Service pack version

'Bn', = Beta version

Base data type: nvarchar(128).

ResourceLastUpdateDateTime

Returns the date and time that the Resource database was last updated.

Base data type: datetime.

ResourceVersion

Returns the version Resource database.

Base data type: nvarchar(128)

ServerName

Both the Windows server and instance information associated with a specified instance of SQL Server.

NULL = Input is not valid, or an error.

Base data type: nvarchar(128)

SqlCharSet

The SQL character set ID from the collation ID.

Base data type: tinyint

SqlCharSetName

The SQL character set name from the collation.

Base data type: nvarchar(128)

SqlSortOrder

The SQL sort order ID from the collation

Base data type: tinyint.

SqlSortOrderName

The SQL sort order name from the collation.

Base data type: nvarchar(128).