Float/real estate encoding is the character Area

Source: Internet
Author: User

 

 

 

-- Class sequence Operators

 

Declare
@ T table
(
Num float
(
38 ))
-- Float/real

Escape as a character

Insert
@ T select
1230

Union all
Select
1234

Union all
Select
123.45

Union all
Select
123.456

Union all
Select
123.4567

Union all
Select
123.45678

 

Select
*,
Rtrim
(
Num)
As
[
Directly escape as a character
] From
@ T

/*

Num

Directly escape as a character

----------------------
-----------------------

1230
1230

1234
1234

123.45
123.45

123.456
123.456

123.4567
123.457 --
With shards

123.45678
123.457 --
With shards

*/

 

 

Select


[
Escape as a character
] =
Case
When
Len
(
Num) =
Charindex
(
'.'
,
Num)
Then
Stuff
(
Num,
Len
(
Num ),
1,
''
)
Else
Num end

From

(


Select


Num = left (
Num,
Len
(
Num )-
Patindex
(
'% [^ 0] %'
,
Reverse
(
Num) +
1)


From
(


Select
Rtrim
(
Cast
(
Num
Decimal
(
38,
10 )))
As
Num from
@ T


)
T

)
T2

/*

Escape as a character

--------------------

1230

1234

123.45

123.456

123.4567

123.45678

 

*/

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.