Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

傳回格式化為百分比 (乘以 100) 且結尾為 % 字元的表達式。

語法

FormatPercent ( Expression [NumDigitsAfterDecimal ] [IncludeLeadingDigit ] [UseParensForNegativeNumbers ] [GroupDigits ] )

FormatPercent 函數語法具有下列自變數:

引數

描述

Expression

必要。 要設定格式的表達式。

NumDigitsAfterDecimal

選擇性。 指出小數顯示右邊多少個位置的數值。 默認值為 –1,表示已使用計算機的地區設定。

IncludeLeadingDigit

選擇性。 表示分數值是否顯示前導符零的三州常數。 請參閱值的 [設定] 區段。

UseParensForNegativeNumbers

選擇性。 指出是否要將負值置於括弧內的三州常數。 請參閱值的 [設定] 區段。

GroupDigits

選擇性。 三州常數,指出是否要使用計算機地區設定中指定的群組分隔符來分組數位。 請參閱值的 [設定] 區段。

設定

IncludeLeadingDigit UseParensForNegativeNumbersGroupDigits 自變數具有下列設定:

常數

描述

vbTrue

–1

True

vbFalse

0

False

vbUseDefault

–2

從電腦的地區設定使用此設定。

註解

省略一或多個選用自變數時,計算機的地區設定會提供省略自變數的值。

附註:  所有設定資訊都來自 [ 地區設定號碼 ] 索引標籤。

範例

Expression

結果​​

SELECT FormatPercent ([DPercent]) As 表達式1 FROM ProductSales;

將 「DPercent」 字段中的值格式化為「百分比」格式,然後在欄運算式1 中傳回。

SELECT FormatPercent ([DPercent],2,-1,-1,-1) AS DPercentage FROM ProductSales;

將 「DPercent」 字段中的值格式化為 2 個小數點的 「百分比」格式,小數點前所有小於 1% 的值都會有「0」。 負值會以括號括住,值會依預設分隔符分組 (“10” 會顯示為 1,000.00%,“-10” 會顯示為 (1,000.00%) ,“0” 會顯示為 0.00%) 。

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×