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

Extra Carriage Returns in Output File 1

Status
Not open for further replies.

md67

Programmer
Nov 20, 2001
15
US
I'm getting a carriage return in my output file after each of my select statements and I don't want the carriage return.

c:\Illinois_temp.sql is basically a command file that contains the following:
----------------------------------------------------------
set nocount on
select hdr from Illinois_Cig_Return where Illinois_CigReturn.row = 1
select records from Illinois_Cig_Return where not (Illinois_Cig_Return.records is null) order by Illinois_Cig_Return.row
select eof from Illinois_Cig_Return where not (Illinois_Cig_Return.eof is null)
-----------------------------------------------------------
The first select statement gets one record. The second select statement will get many records and the third select statement gets one record. My output which is below has a carriage return (and possibly a line feed) after each select statement has been processed and I don't want it there.

I run a query that contains these 2 statements and uses the c:\Illinois_temp.sql file:

set @cmd = 'osql -i"c:\Illinois_temp.sql" -E -s -h-1 -d"Order" -w641 -n ' +
'-o' +
@folder +
@file
exec @cmdshell_result = master..xp_cmdshell @cmd,no_output


-----------------------------------------------------------

My output file looks like this:

*************HDR19E18RC6A M

2020000022124500
3030000122124500
3600000122124500

*************EOF00000016


Any suggestions?
 
I would suggest all 3 select combined into one with union statements.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top