---
title: "remove unwanted zero form column"  
description: "remove unwanted zero form column"  
author: "Manoj Bhatt"  
published: 2013-01-05  
updated: 2013-01-05  
canonical: https://www.mindstick.com/forum/528/remove-unwanted-zero-form-column  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# remove unwanted zero form column

Hi Guys,**\**\
I need the [query](https://www.mindstick.com/blog/202/sub-query-in-sqlserver) for [sql server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) 2008 which [remove](https://yourviews.mindstick.com/story/4554/8-harmful-weeds-to-remove-from-garden) the [extra](https://www.mindstick.com/blog/63570/5-ways-to-make-money-with-the-extra-space-in-your-home) zeroes in the columns below is my [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) [structure](https://www.mindstick.com/articles/23258/choose-your-business-structure-wisely) and [values](https://www.mindstick.com/forum/327/sum-textbox-values)\

```
CREATE TABLE[dbo].[tblZeroes](   iSrNum int PRIMARY KEY IDENTITY,   vNumbers varchar(20))INSERT INTO [dbo].[tblZeroes] VALUES('00001')INSERT INTO [dbo].[tblZeroes] VALUES('001.00')INSERT INTO [dbo].[tblZeroes] VALUES('00001000')INSERT INTO [dbo].[tblZeroes] VALUES('00.001')INSERT INTO [dbo].[tblZeroes] VALUES('0.10')
```

\
Thanks

## Replies

### Reply by AVADHESH PATEL

Hi Manoj Bhatt\
\
You can use below line of code\
\
SELECT Removed_Zeroes=SUBSTRING(vNumbers, PATINDEX('%[^0 ]%', vNumbers + ' '), LEN(vNumbers))\
FROM [dbo].[tblZeroes]\
\
or\
\
SELECT Removed_Zeroes=RIGHT(vNumbers, LEN(vNumbers+'a') -PATINDEX('%[^0 ]%', vNumbers + 'a' ))\
FROM [dbo].[tblZeroes]\
\
Note: ^0 =It means that Find the first position a character in a string which is not 0


---

Original Source: https://www.mindstick.com/forum/528/remove-unwanted-zero-form-column

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
