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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem using rtrim in select when outputting to file with isql

Status
Not open for further replies.

NickW2

Programmer
Jul 23, 2003
12
0
0
GB
When outputting to a file with isql under SQL Server 2000, even if the select statement uses RTRIM on a column, it is still output with trailing spaces.
Is there any way to force the removal of the trailing spaces?
 
What does it mean to have trailing spaces in a text file? Are they actually within a quoted string? If not will adding an ASCII quote character to beginning and end of field within the Select clause give you what you want?
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
I believe that nick is talking about the fact that isql will padd the columns to get them to the correct width because isql wants the output to look nice.

Nick, use BCP to export the data. It doesn't have this annoying little problem.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Ahh. The old is it a bug or feature question.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
yeah pretty much.

The thing to remember about isql is that it's not a data export tool. It's a user interface tool much like query analyzer (Query Alanyzer is isqlw). BCP is the data export tool. isql will format the data to try to make it look easy to read on the screen. But in this format it isn't always easy to process. Hence the use of BCP.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Thanks. I'll use bcp instead.
I was already aware of bcp but was checking if there was another way of using isql to achieve what I wanted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top