Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

cdn.s3techtraining.com
from cdn.s3techtraining.com More from this publisher
17.06.2013 Views

Appendix A: System Functions UNICODE The UNICODE function returns the Unicode number that represents the first character in character_ expression. The syntax is as follows: UPPER UNICODE(‘’) The UPPER function converts all the lowercase characters in character_expression into uppercase characters. The syntax is as follows: UPPER() System Functions 638 The system functions – the more longstanding way of referring to what Microsoft is now referring to simply as “other” – can be used to return information about values, objects and settings with SQL Server. The functions are as follows: ❑ APP_NAME ❑ CASE ❑ CAST and CONVERT ❑ COALESCE ❑ COLLATIONPROPERTY ❑ CURRENT_TIMESTAMP ❑ CURRENT_USER ❑ DATALENGTH ❑ FORMATMESSAGE ❑ GETANSINULL ❑ HOST_ID ❑ HOST_NAME ❑ IDENT_CURRENT ❑ IDENT_INCR ❑ IDENT_SEED ❑ IDENTITY ❑ ISDATE ❑ ISNULL ❑ ISNUMERIC

❑ NEWID ❑ NULLIF ❑ PARSENAME ❑ PERMISSIONS ❑ ROWCOUNT_BIG ❑ SCOPE_IDENTITY ❑ SERVERPROPERTY ❑ SESSION_USER ❑ SESSIONPROPERTY ❑ STATS_DATE ❑ SYSTEM_USER ❑ USER_NAME APP_NAME The APP_NAME function returns the application name for the current session if one has been set by the application as an nvarchar type. It has the following syntax: CASE APP_NAME() The CASE function evaluates a list of conditions and returns one of multiple possible results. It also has two formats: ❑ The simple CASE function compares an expression to a set of simple expressions to determine the result. ❑ The searched CASE function evaluates a set of Boolean expressions to determine the result. Both formats support an optional ELSE argument. Simple CASE function: CASE WHEN THEN ELSE END Searched CASE function: CASE WHEN THEN ELSE END Apendix A: System Functions 639

❑ NEWID<br />

❑ NULLIF<br />

❑ PARSENAME<br />

❑ PERMISSIONS<br />

❑ ROWCOUNT_BIG<br />

❑ SCOPE_IDENTITY<br />

❑ SERVERPROPERTY<br />

❑ SESSION_USER<br />

❑ SESSIONPROPERTY<br />

❑ STATS_DATE<br />

❑ SYSTEM_USER<br />

❑ USER_NAME<br />

APP_NAME<br />

The APP_NAME function returns the application name for the current session if one has been set by the<br />

application as an nvarchar type. It has the following syntax:<br />

CASE<br />

APP_NAME()<br />

The CASE function evaluates a list of conditions and returns one of multiple possible results. It also has<br />

two formats:<br />

❑ The simple CASE function compares an expression to a set of simple expressions to determine<br />

the result.<br />

❑ The searched CASE function evaluates a set of Boolean expressions to determine the result.<br />

Both formats support an optional ELSE argument.<br />

Simple CASE function:<br />

CASE <br />

WHEN THEN <br />

ELSE <br />

END<br />

Searched CASE function:<br />

CASE<br />

WHEN THEN <br />

ELSE <br />

END<br />

Apendix A: System Functions<br />

639

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!