SQL SERVER – Connect Item – Vote for Feature Request Function TRIM

Till date, I have met the SQL Server Product Team twice: first time at SQL Server MVP Meet, Seattle, and second time at TechEd India 2009, Hyderabad. At both the times, I have put forth one request to the product team regarding implementing of function Trim(). As per my opinion, this is the most demanded feature of SQL Server. Almost all the programming languages have function TRIM() which removes space leading and any word that follows. However, SQL Server does not have TRIM() function. It has LTRIM() and RTRIM() functions, which when combined together LTRIM(RTRIM()) works like the expected TRIM() function – which I am proposing.

SQL SERVER - Connect Item - Vote for Feature Request Function TRIM

I have submitted the connect item for requesting TRIM() function. I am requesting all the users to vote for connect item and bring it up to the notice of SQL Server Product Group.

Microsoft Connect SQL Server – Feature Request TRIM()

If you are a SQL Server DBA you can think of the benefits you will gain after this function is implemented; you will save time and energy and there will be no more frustration! It is our moral duty to spread the word for this item and vote for implementation of this feature.

I had previously written the following three articles, which covers workaround, tricks and enhanced functions related to TRIM().

SQL SERVER – TRIM() Function – UDF TRIM()

SQL SERVER – 2008 – TRIM() Function – User Defined Function

SQL SERVER – 2008 – Enhenced TRIM() Function – Remove Trailing Spaces, Leading Spaces, White Space, Tabs, Carriage Returns, Line Feeds

Good News About the Function TRIM

This request finally came true. SQL Server 2017 added a built-in TRIM(), so you no longer need to wrap LTRIM around RTRIM. It can also remove other characters, not only spaces, using the TRIM('.,' FROM @value) form.

One thing to remember: code that uses it will not run on SQL Server 2016 or older, so if you ship scripts to servers you do not control, check their version first. Microsoft Connect has since been retired, so the link above no longer works, but I am glad this one finally shipped. It is a small function, but it makes everyday code cleaner.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

SQL Function
Previous Post
SQL SERVER – List All Objects Created on All Filegroups in Database
Next Post
SQL SERVER – Order of Hotfix and Service Pack

Related Posts

3 Comments. Leave new

  • Brian Tkatch
    June 3, 2009 5:59 pm

    @Pinal

    Typo in the article. “Freature” has an extra “r”.

    Also, just added my vote. Thanx for bringing it up.

    Reply
  • It looks like the feature request got created on the onecare connect and not the SQL Server connect.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.