On Tue, Apr 30, 2019 at 1:53 PM Ted Roche <[email protected]> wrote:

> SELECT LEFT(mMemo,255) as JustText INTO CURSOR Barney
> COPY TO example.csv TYPE CSV
>
> ... if all the memos are less than 256 characters.
>

But if the memos are too long, you'll get a "String is too long to fit" if
you try to use an ALLTRIM() rather than a LEFT(). In that case, you could:

LIST OFF NOCONSOLE alltrim(string(FilePK))+ [,"] + FileMemo + ["] to file
Barney.CSV

and you'll get a CSV file with the file primary key (FilePK in this case)
followed by a comma and the Memo field in quotes.

YMMV, of course, and you might want to wrap a function call around FileMemo
to your own UDF to strip out quotation marks, or carriage returns or the
like.

For extra credit, you could use LLFFs to lop off the top line of the file
that holds the field names, or tell your import program to ignore it.


-- 
Ted "There are 3 ways to do anything in FoxPro, or no way at all" Roche
Ted Roche & Associates, LLC
http://www.tedroche.com


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/CACW6n4ujV7mEr+u7m=dajen3riw9rpzf9j32hqpxgf7a1my...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to