• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

SQL Question - setting a fixed record length using Spool

I'm trying to use the SQL spool command to set a max record length for the output file I'm spooling to. However, when the data exceeds the max record length, it just wraps the data onto the next record.

I'm looking for a way of stopping it writing the extra record, I just want it to truncate the data at the max record length. I can't see an obvious way to do this, and being new to SQL I can't work out the best way to do it. Any advice would be appreciated. Thanks.

For example:

CLEAR BREAKS
SET HEADING OFF
SET LINESIZE 71
SET ECHO OFF
SET SERVEROUTPUT OFF
SET TERMOUT OFF
SET FEEDBACK OFF
SET PAGESIZE 0

SPOOL D:\Data\outputfile.dat
SELECT *
FROM table_name;
SPOOL OFF
/
EXIT

What are you running it on?
 
I've just done the following and it works.

SET LINESIZE 71
SET WRAP OFF
 

Advertisers

Back
Top