Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Removing Spaces

Author  Topic 

KingCarlos
Yak Posting Veteran

74 Posts

Posted - 2010-02-10 : 16:54:57
How do I remove or trim down a record that starts with a space on the left hand side, for example

John

should be

John

Lopaka
Starting Member

48 Posts

Posted - 2010-02-10 : 17:01:13
LTRIM()

Robert R. Barnes
Go to Top of Page

KingCarlos
Yak Posting Veteran

74 Posts

Posted - 2010-02-10 : 17:33:39
update tablename
set colname = LTRIM(colname)


Thanks I finally got this to work !
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-11 : 06:43:28
[code]
update tablename
set colname = LTRIM(colname)
WHERE colname LIKE ' %'
[/code]
would be a bit more efficient by only updating rows where a change was needed.
Go to Top of Page
   

- Advertisement -