SQL Server: Script to Remove Trailing Character from Number Column

In this post, I am providing one TSQL script to remove the trailing characters from Number in SQL Server.

Before a few days ago, I did a data migration from old CSV files to SQL Server table and found that one of our value has some trailing characters like, km, kg.
Actually, this trailing character required to remove from that number column, so I have prepared one TSQL script to perform this task.

First, Create sample table and data:

Select your number with any trailing characters:

The Result:

SQL Server Remove Trail Character

Script to remove trailing characters from Number column:

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

Leave a Reply

Be the First to Comment!

Notify of