I want to remove leading zeros for a varchar column. Actually we are storing version information in a column. Find below example versions.

2.00.001  

The output would be : 2.0.1 

Input : 2.00.00.001  

The output would be: 2.0.0.1 

Input : 2.00  

The output would be : 2.0

The dots in the version column not constant. It may be two or three or four

I found some solutions in google but those are not working. Find below are the queries I tried.

```
SELECT SUBSTRING('2.00.001', PATINDEX('%[^0 ]%', '2.00.001' + ' '), LEN('2.00.001'))

SELECT REPLACE(LTRIM(REPLACE('2.00.001', '0', ' ')),' ', '0')

```

Please suggest me the best approach in sqlserver.