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.
| Author |
Topic |
|
TimR
Starting Member
9 Posts |
Posted - 2012-03-27 : 09:06:22
|
| Is there a way to remove leading and trailing spaces from all fields in a table? I'm using this (below) to clean up field by field but I'd like to run a single process to clean all fields at once-ALTER TABLE namestempALTER COLUMN column2 varchar(20)UPDATE namestemp SET column1 = lTRIM(column1)update namestemp set Column1 = RTRIM(column1)Thanks! |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-03-27 : 09:10:42
|
[code]set column1 = ltrim(rtrim(column1))[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-03-27 : 09:11:20
|
Example:UPDATE namestemp SET column1 = LTRIM(RTRIM(column1)), column7 = LTRIM(RTRIM(column7)) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
TimR
Starting Member
9 Posts |
Posted - 2012-03-27 : 09:40:20
|
| Much better - thanks! |
 |
|
|
|
|
|