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

querying: results to txt includes blank lines at end of results

Status
Not open for further replies.

itprsn

MIS
Jan 6, 2004
40
US
In SQL Server Management Studio Express: when running queries and sending the results to txt I get blank lines (or returns?) at the end of the results. Does anyone know where these blank lines are coming from and how to stop them?? Thanks...
 
Couple different approaches to this:

1. Does it really matter?


2. If you notice, when you run multiple updates you get blanks in between each of the (X rows updated).

3. I saw no check box for this under options.

If [blue]you have problems[/blue], I want [green]source code[/green] AND [green]error messages[/green], none of this [red]"there was an error crap"[/red]
 
1. Yes, the results are saved and used in other programs that error out with the blank lines if they're not removed.

3. I didn't see any check boxes for this either.
 

A.) The other app is going to have to learn to deal with blank lines.

B.) Have the other program actually run the query, thereby actually datatyping the results.

c.) Have an intermediate that cleans the blanks off of the end.

If [blue]you have problems[/blue], I want [green]source code[/green] AND [green]error messages[/green], none of this [red]"there was an error crap"[/red]
 
Instead of using SQL Server Management Studio Express, I encourage you to use BCP instead. BCP is a command line utility that allows you to import/export data. BCP can also use a format file to help you export the data in to a flat file in exactly the format you require. With BCP, you won't have the 'extra lines' issue that you have with SSMS.

There's tons of documentation out there for [google]BCP[/google]. Take a look at some of it. If you continue to have problems, let us know.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top