Computer Hope

Microsoft => Microsoft DOS => Topic started by: luvsun27 on December 17, 2008, 02:45:19 PM

Title: copy function adding an extra character
Post by: luvsun27 on December 17, 2008, 02:45:19 PM
I am using the copy function to create 1 file from 2 files.  When I open the file using texpad as the editor, there is an extra character in the first position.  I'm not sure how it's getting there and how to get rid of it.  Any help would be appreciated.

copy f:\sybwork\KRV\KWI_PHONESEND_RETURN_O+f:\sybwork\KRV\KWI_PHONESEND_RETURN_M f:\sybwork\KRV\KWI_PHONESEND_RETURNS

I attached 2 picture.  When I open it in texpad, it adds the symbol to the first position..when I open it in notepad, it looks normal, and how I want it to transmit.  The person loading it, is seeing the extra character when trying to upload it into a unix program.  Thanks.

[attachment deleted by admin]
Title: Re: copy function adding an extra character
Post by: Dusty on December 18, 2008, 12:23:33 AM
Welcome to the CH forums.

Which program created the files?   You may have a formatting code added in much the same way that a word processor will add control characters.  Viewing the input files in a hex editor might show that the extra character is already in the file, or you could try displaying the input files in Textpad.  If the extra character is displayed then Copy is not the culprit.
Title: Re: copy function adding an extra character
Post by: luvsun27 on December 18, 2008, 05:14:44 AM
Hi...the input files do not have the extra character.  They are being created via a BCP queryout statement from a SQL Server database.  It seems that before the files are copied together as one, they are fine..only after the copy, they have the extra field.  Any oher ideas?
Title: Re: copy function adding an extra character
Post by: Dusty on December 19, 2008, 12:52:27 AM
Sorry, I haven't been able to replicate your problem..   Found some info that FF FE FF FE (the hex of the additional chars you show) can be added to output when mapping to CSV using Mapforce to signal to a processor which 16-bit character encoding is in use, but as you didn't mention that it's probably not any part of your problem.

Would you reverse the order in which you select the files to copy so that file1+file2 becomes file2+file1 and have a look for the spurious characters in the output file again please.   Am interested to find out if the characters still appear at the start of the output file.

Is this problem something new, have you been able to copy the files without the chars?

Title: Re: copy function adding an extra character
Post by: Dias de verano on December 19, 2008, 01:04:09 AM
They are being created via a BCP queryout statement from a SQL Server database.

Another thread about extra characters added following DB query. Maybe related?

Quote
My database is PostgreSQL 8.2.  I've been trying to code a small export process.  My .bat runs a .sql that contains some basic select statements.  The output is catted to a .txt file.

Quote
I decided to change my SQL code so my data gets written to a temp table, and then I used a COPY TO in my SQL to generate the necessary output file.  This eliminated the space in the first byte of each row.  This might be a PostgreSQL issue that is caused when the output from a SELECT is catted to an external file.

http://www.computerhope.com/forum/index.php/topic,71941.0.html