Hi @Gowsalya
Check this query:
CREATE TABLE #TEST(Column1 VARCHAR(20))
INSERT INTO #TEST VALUES('M12.07'),('M12.010'),('M12.00'),('M12.70'),('M120'),('ABC')
SELECT CASE WHEN CHARINDEX('.',Column1)>0 AND RIGHT(Column1,1)='0'
THEN REVERSE(STUFF(REVERSE(Column1),1,PATINDEX('%[^0.]%',REVERSE(Column1))-1,''))
ELSE Column1 END
FROM #TEST
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.