SQL Server-Supported Functions
This section provides an alphabetical listing of Microsoft SQL Server-supported functions, with examples and corresponding results.
- ACOS(
number
) Returns the arccosine of
number
, ranging from −1 to 1. The result ranges from 0 to π and is expressed in radians. For example:SELECT ACOS( 0 )
-> 1.570796- APP_NAME( )
Returns the application name for the current session, set by the application. For example:
SELECT APP_NAME( )
-> 'SQL Enterprise Manager'- ASCII(
text
) Returns the ASCII code of the first character of
text
. For example:SELECT ASCII('x')
-> 120- ASIN(
number
) Returns the arcsine of
number
, ranging from −1 to 1. The resulting value ranges from -π/2 to π/2 and is expressed in radians. For example:SELECT ASIN( 0 )
-> 0.000000- ATAN(
number
) Returns the arctangent of any
number
. The resulting value ranges from -π/2 to π/2 and is expressed in radians. For example:SELECT ATAN( 3.1415 )
-> 1.262619- ATN2(
float1
,float2
) Returns the angle (in radians) whose tangent is
float1
/float2
. For example:SELECT ATN2( 35.175643, 129.44 )
-> 0.265345- BINARY_CHECKSUM(* |
expression
[, . . .n
]) Returns the binary checksum for a list of expressions or for a row of a table. This example returns a list of user IDs where the stored password checksum doesn’t match the current password’s checksum:
SELECT userid AS 'Changed' FROM users
WHERE NOT password_chksum = BINARY_CHECKSUM( password )
- CHAR(
integer_expression
) Converts a numeric ASCII code to a character. For example:
SELECT CHAR( 78 )
-> 'N' ...
Get SQL in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.