SQL Trim
Function removes white spaces (incl. ones in the middle). For Microsoft SQL Server 2005/2008

Trims:
1) Leading spaces
2) Trailing spaces
3) White spaces of any length in the middle. Where LTRIM(RTRIM()) don't succeed

Plain, simple, easy.

Add this function to your database and you're ready to go.

Included:
- CREATE FUNCTION script
- Test/sample script



Tags:
sql trim spaces
sql trim function
sql trim string
sql trim leading zero
LTRIM RTRIM UDF TRIM TRIM()
remove double spaces
remove white space
remove whitespace
remove more than 2 spaces from the middle of string
remove more than two spaces from the middle of string
mssql trim
trim() error
trim in sql
trim function in sql
LTRIM(RTRIM())

Last edited Feb 3, 2011 at 2:52 PM by heberd, version 11