MS Access Format() 函数
示例
将数值表达式格式化为百分比:
SELECT Format(0.5, "Percent") AS FormattedNum;
亲自试一试 »
定义和用法
Format() 函数使用指定的格式格式化数值。
语法
Format(
value,
format)
参数值
Parameter |
Description |
value |
Required. The numeric value to format |
format |
Optional. The format to to use.
Format |
Description |
General Number |
Indicates a number, without thousand separators |
Currency |
Indicates currency, with thousand separators and two decimal places |
Fixed |
Shows minimum one digit to the left of the decimal place and two digits to the right of the decimal place |
Standard |
Shows the thousand separators + minimum one digit to the left of the decimal place, and two digits to the right of the decimal place |
Percent |
Shows a percent value (with percent sign) and two digits to the right of the decimal place |
Scientific |
Indicates scientific notation |
Yes/No |
Shows No if value = 0 and Yes if value <> 0 |
True/False |
Shows False if value = 0 and True if value <> 0 |
On/Off |
Shows Off if value = 0 and On if value <> 0 |
|
技术细节
更多示例
示例
将 "Price" 列设置为货币格式:
SELECT Format(Price, "Currency") AS FormattedPrice
FROM Products;
亲自试一试 »