Chức năng định dạng truy cập MS ()
Ví dụ
Định dạng biểu thức số thành phần trăm:
SELECT Format(0.5, "Percent") AS FormattedNum;
Hãy tự mình thử »
Định nghĩa và cách sử dụng
Hàm Format() định dạng một giá trị số với định dạng được chỉ định.
Cú pháp
Format( value , format )
Giá trị tham số
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 |
|
Chi tiết kỹ thuật
Hoạt động trong: | Từ Access 2000 |
---|
Thêm ví dụ
Ví dụ
Định dạng cột "Giá" thành tiền tệ:
SELECT Format(Price, "Currency") AS FormattedPrice
FROM Products;
Hãy tự mình thử » Người tìm đường W3schools
Theo dõi tiến trình của bạn - hoàn toàn miễn phí!