Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stripping Spaces from SQL ASCII Output
Message
From
22/04/1998 13:31:10
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
22/04/1998 12:55:58
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:
00094063
Views:
24
Try a wrapper function then :
function dumper
lparameters cTablename
use (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

>I have an additional requirement that I did not include in my first message.
>
>That is that I need to end up with an ASCII file with data that is delimited with a tilde (~) for both numeric and character data ie; abc~123~def. The data cannot have leading or trailing blanks.
>
>I hope, trust and pray that there is a way to do this programatically.
>
>
>
>>>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?
>>>
>>>Bob
>>
>>SELECT ALLTRIM(STR(number)) as dummy from table1 into cursor tmp nofilter
>>copy to ascii.txt type ....
Ç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
Reply
Map
View

Click here to load this message in the networking platform