Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The number in Replicate creates a problem
Message
 
 
To
06/04/2022 06:15:04
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01684050
Message ID:
01684094
Views:
37
>>>>>The problem is the use of ALLTRIM with a field longer then 10 chars in SELECT SQL. Look at message#01684075, I gave all the info were the problem comes from there.
>>>
>>>Thanks, Lutz! And your explanation holds up with various other tests- e.g.
>>>
>>>
SELE ALLTRIM(LEFT(c1,4)) AS c1 FROM mycur INTO CURSOR cmycur
>>>
>>>It processes the LEFT to decide field length, but not the ALLTRIM. It's as if the VFP parser is "smart" enough to know that ALLTRIM() can and I'm sure used to deliver undersized resultset fields. So, ignoring alltrim() when calculating selected field lengths makes sense, but a cause for unexpected issues as seen by Dmitry!
>>>
>>>FWIW, I'm pretty sure there was a time when you had to PADR() expressions to prevent undersized results, with confirmations as recently as 2003 on internet search- but I can't provoke it now by using SET ENGINEBEHAVIOR 70 etc. Maybe it got fixed in VFP7, leaving dinosaurs like me laboring on with obsolete truths. ;-)
>>>
>>>I experimented using varchar; your example now works as expected, yielding a V(10) result field with len(c1)=0 for first row... , but the same issue Dmitry saw with replicate and V(15).
>>
>>Yes, I have learned a lesson.
>
>Me too. In special about odd error messages . :)

Just FYI, I ran these examples that we discussed in the SSMS (against SQL Server). And SQL Server does not give you an error. What it does, if REPLACE() comes across a negative number, the SQL set the calculated column to NULL.
I don't know though which is better, VFP or SQL.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform