The STR function converts numeric data into character data.

Source: Internet
Author: User

STR (float_expression [, length [, decimal])
Parameters
Float_expression
An expression of the approximate number (float) data type with a decimal point.
Length
Total length. It includes the decimal point, symbol, number, and space. The default value is 10.
Decimal
The number of digits after the decimal point. Decimal must be less than or equal to 16. If the decimal value is greater than 16, the result is truncated to keep it

It has Sixteen digits after the decimal point.
Return type
Char

The STR function converts a number to a character. An optional parameter is used to specify the total length of the result (including the decimal point and the number of digits after the decimal point ).

The STR length and decimal parameter (if provided) should be a positive number. The default length is 10. When the default or decimal parameter is 0

, The number is rounded to an integer. The specified length should be greater than or equal to the length of the number before the decimal point plus the number symbol (if any ).

Degree.

In the following example, the float expression of 123.45 is converted to six characters in length and two decimal places.

Select STR (123.45, 6, 2 );
 
The following is the result set:
------
123.45

(1 row (s) affected)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.