Hi
I have value displayed 17125.000000 in sql query . I want to remove 3 zeros from right side
It should display 17125.000
Thanks
Hi
I have value displayed 17125.000000 in sql query . I want to remove 3 zeros from right side
It should display 17125.000
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh KumarPosted Jan 16, 2024, 8:33 AM
You can convert it into Varchar(20) from that value as below,
Amit MohantyPosted Jan 16, 2024, 7:47 AM
If your value is varchar then:
Jayraj ChhayaPosted Jan 16, 2024, 7:37 AM
To remove trailing zeros from a value in SQL, you can use the
TRIMfunction along with the0character. Here's an example:In this example, the
TRIMfunction is used to remove the trailing zeros from the value'17125.000000'. The result will be'17125'.If you have a column in a table that contains the value
'17125.000000', you can use the same approach:Replace
column_namewith the actual name of the column andtable_namewith the actual name of the table.By using the
TRIMfunction with theTRAILINGkeyword, you can remove trailing characters from a string. In this case, we are removing the trailing zeros.Ramco RamcoPosted Jan 16, 2024, 7:12 AM
Hi Jignesh
I am converting this value as varchar . From this i want to remove 3 decimals from right.
Thanks
Jignesh KumarPosted Jan 16, 2024, 6:34 AM
Hello Ramco,
Please use this query,
Amit MohantyPosted Jan 16, 2024, 6:31 AM
You can also use
FORMAT: