Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TEXT oddity
Message
From
14/09/2023 11:00:10
 
 
To
14/09/2023 10:47:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01687052
Message ID:
01687059
Views:
42
>>>I use TEXT to create SQL commands e.g.:
>>>
>>>
>>>TEXT TO lc_sqlstring 
>>>        select *   from hhpickup  where left(storecode,11) = ?lc_pickupstore and ( CAST(pickupdate AS date) =
>>>         ?ld_date1 OR
>>>         CAST(pickupdate AS date) =  ?ld_date2 OR
>>>         CAST(pickupdate AS date) =  ?ld_date3)
>>>         AND NOT EXISTS (SELECT idcol FROM depdetail WHERE store = hhpickup.storecode AND RIGHT(RTRIM(LTRIM(sealnumber)),7) =
>>>		  RIGHT(RTRIM(LTRIM(hhpickup.sealnumber)),7)
>>>         and postingdate <= ?ld_entdate)
>>>         ORDER BY sealnumber
>>>
>>>ENDTEXT
>>>
>>>That worked for hundreds of thousands of different iterations but today, in one case, the text appeared on the form that was executing it. I added NOSHOW and all was well again.
>>>What happened?
>>
>>What tore said... Just jumping in with a why not:
>>inlist( CAST(pickupdate AS date), ?ld_date1, ?ld_date2, ?ld_date3)
>>
>>instead of the OR construct?
>
>Dragan
>I'm building a command for SQL Server.
>When I try INLIST in SQL Server I get:
>
>'INLIST' is not a recognized built-in function name.

Then use IN () clause
CAST(pickupdate AS date) IN ( ?ld_date1,  ?ld_date2,  ?ld_date3)
BTW you can use this in VFP too.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform