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 2000 Forums
 SQL Server Development (2000)
 SQL Trim function?

Author  Topic 

RichardSteele
Posting Yak Master

160 Posts

Posted - 2003-03-07 : 21:31:42
What is the SQL trim function? I'm trying to find the datalength of column and need to trim the spaces at the end of that column. Thanks in advance.

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-03-07 : 21:34:45
LTRIM for Trimming spaces from the left
RTRIM for Trimming spaces from the right

Take a look at BOL for more specifics.
Make sure you look under topic
sp_dbcmptlevel
for a discussion on how it affects the results of the trimming functions.



Go to Top of Page

RichardSteele
Posting Yak Master

160 Posts

Posted - 2003-03-07 : 21:48:29
Thanks. The Rtrim doesn't seem to work on text fields. Please advise.

Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-03-07 : 23:44:31
Two options that I see
1.
use readtext,updatetext, and Patindex to process text data and remove spaces.

2.
a.BCP data out
b.write a vb script to trim input lines and write output file
c.BCP data in from output file.



Go to Top of Page
   

- Advertisement -