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
 General SQL Server Forums
 New to SQL Server Programming
 Trim fields

Author  Topic 

joelseverich
Starting Member

34 Posts

Posted - 2009-09-29 : 17:14:52
hi
is there a way to trim fields in select statement

X002548
Not Just a Number

15586 Posts

Posted - 2009-09-29 : 17:27:34
SELECT RTRIM(Col1) FROM TABLE

????



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

dattatreysindol
Starting Member

20 Posts

Posted - 2009-09-29 : 17:38:25
quote:
Originally posted by X002548

SELECT RTRIM(Col1) FROM TABLE

????



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam







Dattatrey Sindol
http://mytechnobook.blogspot.com/
Go to Top of Page

dattatreysindol
Starting Member

20 Posts

Posted - 2009-09-29 : 17:41:40
Please use LTRIM(RTRIM(FieldName)) instead of just RTRIM(FieldName).

RTRIM(FieldName) removes the extra spaces at the end of the word. By using LTRIM(RTRIM(FieldName)) we can ensure to remove the extra spaces at both ends.

Hope that helps!

Dattatrey Sindol
http://mytechnobook.blogspot.com/
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-09-29 : 18:42:57
Are you also worried about spaces in the middle of a "Field"

Raed my BlogSplot



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -