Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stored procedure
Message
From
07/09/2004 18:39:58
 
 
To
07/09/2004 18:38:04
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00940107
Message ID:
00940132
Views:
19
Opps, that should have been
llQuery=.T.
SELECT newid('CUSTPAYMENT',@llQuery) as nextid ;
	FROM wots!wotscont INTO CURSOR tNextId
>The only way I can think of is to pass an extra parameter into the select stored procedure.
>
>
llQuery=.T.
>SELECT newid('CUSTPAYMENT',llQuery) as nextid ;
>	FROM wots!wotscont INTO CURSOR tNextId
>
>where
>
FUNCTION NewID(tcAlias, tlQuery)
>*************************************************************************
>LOCAL lcAlias as Character,;
>		lnID as Integer,;
>		lcOldReprocess as Character,;
>		lnOldArea as Number
>
>	IF tlQuery
>		tlQuery = .F.
>		lnID = 0
>	ELSE
>		:
>		:
>		lnID = oldID+1
>		:
>	ENDIF
>	RETURN lnID
>ENDFUNC
>
>
>The reason for this is that I want to be able to get the next unique key from a remote view so I can use it during an tableupdate() of header-trailer tables. Perhaps there is a better way, any ideas?
>
>Regards
>Geoff
>>Hi Hilmar
>>
>>
SELECT IIF(not table='CUSTPAYMENT',999999999999,newid('CUSTPAYMENT')) as nextid ;
>>	FROM ids WHERE table='CUSTPAYMENT' INTO CURSOR tNextId
>>
>>
>>executes the stored procedure twice even though there is only one record in with table='CUSTPAYMENT'
>>
>>I have tried with RECNO() also but no success. Maybe I am not understanding you correctly,
>>do you have an example?
>>
>>Thanks
>>Geoff
>>
>>>Did I understand correctly, that you want to execute the stored procedure only for records that fulfill other criteria?
>>>
>>>One way would be to add the stored procedure at the end of a series of AND statements. Shorcut Boolean evaluation should take care of only evaluating the function when the previous conditions are .T.
>>>
>>>>Hi
>>>>
>>>>How do I create an SQL SELECT statement that uses a stored procedure (or other procedure) so that that procedure is only called when there is a valid record in the when statement.
>>>>
>>>>Foxpro currently calls the procedure during the initialisation phase of the select and then again for each row in the WHERE. Is it possible to avoid the initialisation call?
>>>>
>>>>Regards
>>>>Geoff Scott
May all your weeds be wildflowers
Previous
Reply
Map
View

Click here to load this message in the networking platform