Hi firstly I want to appreciate your teaching method is to much good.. .. Also if there any upcoming course for SQL- power bi. Then. Plz inform us ... Waiting for your positive response..😇
How would you remove zeros after a decimal for an entire column? Example 62.000000000. Remove the decimal and all zeros after for the whole column. I'm new to SQL and cant seem to fins the right query. Thanks
Thank you! This is interesting, but such code is poorly understood and not portable. IMHO it's better to use the classic CASE. SELECT CASE WHEN PATINDEX('%[^0]%', @col)>0 THEN SUBSTRING(@col, PATINDEX('%[^0]%', @col) , len(@col)) ELSE '' END
Thanks! Very well explained, you have a new subscriber.
Thank you for your support 🙏
How to replace leading zeroes with another character
Hi firstly I want to appreciate your teaching method is to much good.. ..
Also if there any upcoming course for SQL- power bi. Then. Plz inform us ... Waiting for your positive response..😇
Thank you for your support. We will be planning the courses soon 🙏
How would you remove zeros after a decimal for an entire column? Example 62.000000000. Remove the decimal and all zeros after for the whole column.
I'm new to SQL and cant seem to fins the right query. Thanks
In MySQL, you can do select cast(62.000000 as float); It will output 62. If you have 62.0000100, then the output will be 62.00001
Thank you! This is interesting, but such code is poorly understood and not portable. IMHO it's better to use the classic CASE.
SELECT
CASE WHEN PATINDEX('%[^0]%', @col)>0 THEN SUBSTRING(@col, PATINDEX('%[^0]%', @col) , len(@col))
ELSE ''
END
Thank you for sharing your thoughts. It really helps us all learn and grow 🙏