Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trimming whitespaces of a column 1

Status
Not open for further replies.

williey

Technical User
Jan 21, 2004
242
I need to try the excess whitespaces of a column when I spool it to a file. Take for an example, a column defined as varchar(50). But the actual data is only 20 chars long. I need to trim the remaining 30 when it is spooled to a file.

Tried rtrim, ltrim, etc but it does not work..

Birth of new OSs is the natural evolution of Unix.
 

You need to "concatenate" the columns:
Code:
set trims on lin 132 pages 0 term off ver off feed off
SPO Result.txt
SELECT col1||'|'||col2||'|'|col3
  FROM MyTable;
[3eyes]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Thanks! That example now reminds me how we do it at my previous job.

Birth of new OSs is the natural evolution of Unix.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top