robthomas09
asked on
SQL Syntax - Remove blank space Padding from string
I have data stored in a string column, and it has white space blank padding on either side:
table: person
name
' john '
' jane '
I would like to remove the left and right space padding on either side - and the padding length is unknown.
table: person
name
' john '
' jane '
I would like to remove the left and right space padding on either side - and the padding length is unknown.
Something like:?
Left(name, CHARINDEX (' ', name, CHARINDEX (' ', name) + 1) - 1)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
TRIM(name) will do the job for you.
Sorry TRIM is not there in SQL Server. rushShah is correct. You can also use:
SELECT rtrim(ltrim(name))
SELECT rtrim(ltrim(name))
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks - will try and let you know