Note that there are some explanatory texts on larger screens.

plurals
  1. PObcp format file and -c switch out
    primarykey
    data
    text
    <p>I am trying to use <code>bcp</code> to extract records from a Sybase ASE database and write them to a file. I need to exclude two of the fields in the database, so I'm trying to use a format <code>.fmt</code> file. </p> <p>This is my bcp:</p> <pre><code>bcp Rdevdb..TBL_XFER out out1.txt -S$serv -U$user -P$pass -fbcp.fmt -c -t\| </code></pre> <p>I need the | char to be the delimiter.</p> <ol> <li><p>When I use the <code>-c</code> switch, it seems like it's ignoring the format file all together, is this true?</p></li> <li><p>When I use neither the <code>-n</code> or the <code>-c</code> switch (to tell it what format, native or char) it seems to create the file using native format, for when I open it in my text editor it forces it into a hex editor... is this the case?</p></li> <li><p>when I include the <code>-c</code>, and in the format file I remove the two fields that I do not want, it brings all the db fields into the file, that's why I'm thinking it'd ignoring the .fmt file.</p></li> <li><p>If I remove the <code>-c</code> switch, and run it with the two fields not included into the .fmt file, I get this error: <code>Incorrect host-column number found in bcp format-file.</code></p></li> <li><p>What combination of switches and what do I include in the .fmt file in order to get my <code>bcp</code> command to bringing me the results I want?</p></li> </ol> <p>Here's a portion of the <code>.fmt</code> file. There are no spaces in any of the table field names (this does not include field 1 or field 2, as those are the ones I do not want in the file).</p> <pre><code>10.0 147 3 SYBCHAR 2 6 "|" 3 COVERAGE_CODE 4 SYBCHAR 2 6 "|" 4 DEPT 5 SYBCHAR 2 8 "|" 5 ORG 6 SYBCHAR 2 8 "|" 6 DIV 7 SYBCHAR 2 8 "|" 7 DISTRIBUTE ... </code></pre> <p>There are 147 fields in the table, though when I include all the fields in the .fmt file, there are a total of 149 with the first two lines that designate the version and the field number.</p> <p>Thanks for any help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload