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

sql results to a text file

Status
Not open for further replies.

cards4

Technical User
Dec 9, 2004
38
US
Hello,
I am running a test batch file that runs a sql query and puts the SQL results into a text file. In my query, I tell it to RTrim on all of the string columns. When I view the text file, there are still spaces that appear between the different columns of information. What is it that I can do to get rid of those spaces? Thank you.
 
Use BCP to export the data not osql or isql. BCP is a data import/export tool, osql/isql are sql command tools, and are not made for data import/export.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
BCP is a command line data import/export tool. It's used to load data from a text file into the SQL Server, or exporting data from a table, query or stored procedure to a text file. There is more information available in Books OnLine. You can also bring up a command prompt, and run BCP /? do get the list of paramaers.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top