• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • 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

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #11
    Originally posted by Moose423956 View Post
    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?
    Best Forum Advisor 2014
    Work in the public sector? You can read my FAQ here
    Click here to get 15% off your first year's IPSE membership

    Comment


      #12
      He is running against Oracle using sqlplus.

      Comment


        #13
        Originally posted by OrangeHopper View Post
        He is running against Oracle using sqlplus.
        In that case, I'll stand by my original suggestion.
        Best Forum Advisor 2014
        Work in the public sector? You can read my FAQ here
        Click here to get 15% off your first year's IPSE membership

        Comment


          #14
          I've just done the following and it works.

          SET LINESIZE 71
          SET WRAP OFF

          Comment

          Working...
          X