Friday, 19 August 2011

Built-in Functions - Configuration Functions


@@DATEFIRST Function


Returns the value of SET DATEFIRST (with DATEFIRST, 1 stands for Monday, 2 stands for Tuesday, and so on). Example:


1.SELECT @@DATEFIRST

@@DBTS Function


Current value of TIMESTAMP data type within the current database. Example:


1.SELECT @@DBTS


Results:


1.------------------ 
2.0x00000000000007D4

@@LANGID Function


Language id of the current language in use. You can modify the language to be used by running SET LANGUAGE statement. Example:


1.SET LANGUAGE deutsch  GO  SELECT @@LANGID


Results:


1.Die Spracheneinstellung wurde auf Deutsch geändert.  
2.------ 
3.1

@@LANGUAGE Function


Language name of the current language in use. Example:


1.SELECT @@LANGUAGE

@@LOCK_TIMEOUT Function


Lock timeout setting for current connection. You can alter the value of this function by executing SET LOCK_TIMEOUT statement by specifying maximum amount of time (in milliseconds) SQL Server should wait before canceling the statement for which locks are not available. Default value is -1 meaning that SQL Server will wait indefinitely. Example:


1.SELECT @@LOCK_TIMEOUT

@@MAX_CONNECTIONS Function


Maximum connections allowed on the current instance of SQL Server. You can alter the value returned by this function by executing sp_configure. Maximum number of connections allowed on any SQL Server instance is 32767 but this number will be limited by your hardware and / or edition of SQL Server you're using. Example:


1.SELECT @@MAX_CONNECTIONS

@@MAX_PRECISION Function


Precision level used by default for NUMERIC and DECIMAL data types. Default value is 38. Example:


1.SELECT @@MAX_PRECISION

@@NESTLEVEL Function


Nesting level of current procedure execution (incremented each time one stored procedure executes another). Example:


1.SELECT @@NESTLEVEL

@@OPTIONS Function


SET options for the current connection. The value returned by this function can be altered by executing sp_configure and changing user options. This function returns an integer representation of the binary value that stores connection settings. Example:


1.SELECT @@OPTIONS

@@REMSERVER Function


Returns the name of the remote SQL Server from which a stored procedure is executed. This function is deprecated and will not be supported in future versions of SQL Server. Example:


1.SELECT @@REMSERVER

@@SERVERNAME Function


Returns the name of the local SQL Server. Example:


1.SELECT @@SERVERNAME

@@SERVICENAME Function


Name of the registry key under which SQL Server is running. Returns the instance name for non-default instances. For the default instance returns MSSQLSERVER. Example:


1.SELECT @@SERVICENAME


Results:


1.------------------- 
2.SQLSERVER2005

@@SPID Function


Current server process id (spid). Example:


1.SELECT @@SPID

@@TEXTSIZE Function


Current value of TEXSIZE option. The value returned by this function can be altered by executing SET TEXTSIZE statement to specify the upper limit for the length of columns with VARCHAR(MAX), NVARCHAR(MAX), NTEXT, TEXT, IMAGE and VARBINARY(MAX) data types. Example:


1.SELECT @@TEXTSIZE

@@VERSION Function


Date, version, and processor type for the current instance of SQL Server. Example:


1.SELECT @@VERSION


Results:

1.Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)   Oct 14 2005 00:33:37   Copyright (c) 1988-2005 Microsoft Corporation   Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

No comments:

Post a Comment