Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

OSQL data formating problem

Posted on 2008-06-19
3
Medium Priority
?
935 Views
Last Modified: 2012-06-27
OSQL - problem a line break is occuring in the output.

In certain records line breaks are introduced into the output while using osql
The data in the database is free from line breaks and carriage returns and all other non alphanumeric characters.

I've changed the "maximum characters per column" in query analyser to 8000 and tried increasing the dos window size to 1000. But that doesn't work.

If I use query analyser with results to file the data output is fine.

I'm using SQL server 2000

The OSQL is :-
osql -S ServerName -d DatabaseName -E -w1200 -Q DatabaseName.dbo.StoredProcedureName -o C:\OutFile.csv

The stored procedure (StoredProcedureName) queries various tables and uses a cursor with print to output the data as comma separated variables. This output is 910 characters long including the commas  
0
Comment
Question by:Pete_Burke
  • 2
3 Comments
 
LVL 30

Assisted Solution

by:nmcdermaid
nmcdermaid earned 500 total points
ID: 21828746
What do you mean by:

>> If I use query analyser with results to file the data output is fine.

Is a DOS window the only point you are seeing a line break?? It is practical to only ever send it to a file and view the file?
0
 

Accepted Solution

by:
Pete_Burke earned 0 total points
ID: 21828846
In query analyser right click on the query window and select the option "results to file" in that file the output is ok.

The OSQL is :-
osql -S ServerName -d DatabaseName -E -w1200 -Q DatabaseName.dbo.StoredProcedureName -o C:\OutFile.csv

in the file C:\OutFile.csv some records have line breaks.
0
 

Author Comment

by:Pete_Burke
ID: 22067840
points awarded
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question