Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

Format

Example

Format the “Price” column as currency.

SELECT Format(Price, “Currency”AS FormattedPrice
FROM Products;

Definition and Usage

The Format() function applies a specified format to format a given value.

Syntax

Format(valueformat)

Parameter Values

Parameter

Description

value

Mandatory. Specifies the string or value that is to be formatted.

format

Optional. Specifies the format to apply to the value being formatted.

Format

Description

General Number

Represents a number without any thousand separators

Currency

Represents currency with thousand separators and precisely two decimal places.

Fixed

Displays at least one digit to the left of the decimal point and two digits to the right of the decimal point.

Standard

Displays thousand separators, with at least one digit to the left of the decimal point and two digits to the right of the decimal point.

Percent

Formats a number as a percentage with a percent sign and two digits to the right of the decimal point.

Scientific

Represents a number in scientific notation.

Yes/No

Displays “No” if the value equals 0, and “Yes” if the value is not equal to 0.

True/False

Displays “False” if the value equals 0, and “True” if the value is not equal to 0.

On/Off

Displays “Off” if the value equals 0, and “On” if the value is not equal to 0.

General Date

Displays the value as a date according to the system settings.

Long Date

Formats the value as a date according to the system’s long date settings.

Medium Date

Formats the value as a date according to the system’s medium date settings.

Short Date

Formats the value as a date according to the system’s short date settings.

Long Time

Formats the value as a time according to the system’s long time settings.

Medium Time

Formats the value as a time according to the system’s medium time settings.

Short Time

Formats the value as a time according to the system’s short time settings.

Technical Details

Works in:

 From Access 2000