Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stripping Spaces from SQL ASCII Output
Message
From
23/04/1998 17:04:43
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/04/1998 17:02:35
Robert Byrd
National Association of Homebuilders
Washington, District of Columbia, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00093816
Message ID:
00094486
Views:
24
>I greatly appreciate your response. But speed is kind of important, and I have found a single-pass solution (courtesy of this forum but I cannot locate the person's name to give him credit).
>
>It is as follows:
> lparameters t_cTablename
>
> use (t_cTablename)
> handle=fcreate("dumped.txt")
> scan
> =fputs(handle,dumprecord())
> endscan
> =fclose(handle)
>
> function dumprecord
> thisline = ""
> for ix = 1 to fcount()
> do case
> case type(field(ix))$"CM"
> newline = alltrim(eval(field(ix)))
> case type(field(ix))$"NFYB"
> newline = alltrim(str(eval(field(ix))))
> case type(field(ix))$"L"
> newline = iif(eval(field(ix)),"True","False")
> case type(field(ix))="D"
> newline = dtoc(eval(field(ix)))
> case type(field(ix))="T"
> newline = ttoc(eval(field(ix)))
> otherwise
> newline = ""
> endcase
> thisline=thisline+"~"+newline
> endfor
> return thisline
>
>Again, many thanks!
>
>
>>Bob,
>>
>>use the COPY TO clauses as suggested here to create a temp version, but since you are dealing with so many records I think you'll run into memory problems trying to chrtran() the whole file at once. So do it one line at a time:
>>
>>
copy to temp.txt delimited ~
>>create table temp2 cline c(254) && might need more than 1 field is >254 char/line
>>append from temp.txt type sdf
>>set textmerge to TheRealFile.TXT
>>set textmerge on
>>scan
>>   \<<chrtran( cLine, ["], '' )>>
>>endscan
>>set textmerge off
>>set textmerge to

>>
>>>If I do [SELECT ALLTRIM(STR(number)) TO FILE ascii.txt] I get leading blanks in the output for records where the length of the data is less than the maximum length. I need output data with no leading or trailing blanks. Any ideas?
Why my reply bounced back to me ?
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform