>>>>>Hi All,
>>>>>
>>>>>I work with Visual Foxpro. I have to use Dynamic Where Clause in my SQL Server queries.
>>>>>
>>>>>I found two options on the threads :
>>>>>1) SELECT * FROM Table WHERE (SELECT CASE ...) = (SELECT CASE ...)
>>>>>2) DECLARE @SqlStatement varchar(4000)
>>>>> SET @SqlStatement = 'Sql Statement'
>>>>> EXEC (@SqlStatement)
>>>>>
>>>>>I'd like to know which option offer better performance.
>>>>>Or is there other options ?
>>>>>
>>>>>Thanks for your help.
>>>>
>>>>They are not equal, but 2 is the best, sure.
>>>
>>>Hi Fabio,
>>>
>>>You say that they are not equal, about results or performance ?
>>>
>>>Thanks for your answers
>>
>>Both
>>The second it is more performante ( and SQL can optimize it best),
>>but the execution happens in a different scope.
>>
>>For example if you uses the variable @VARIABILE,
>>you cannot be used it directly into the @SqlStatement string.
>>
>>DECLARE @SqlStatement varchar(4000),@VARIABILE ...
>>SELECT @VARIABILE=....
>>SET @SqlStatement = 'Sql ...@VARIABILE ....Statement'
>>EXEC (@SqlStatement) <== THIS FAIL
>>
>>You can think @VARIABILE like a VFP Local variable.
>>SQL haven't PUBLIC or PRIVATE variables.
>
>Thanks for your help.
>
>Do you know if it's possible to have a progress bar that show to the user the progression of an update or select SQL ?
Yes, but a best an linear solution is not possible
( like a Thread or a Timer for refresh the progress bar )
because VFP don't allow a bindevent to the ODBC internal fetch cycle,
and on sync mode the process is atomic.
For update you can do the update into a LOOP
For select it is possible with a async download ( it is slower ),
but you have to known the final RECCOUNT().
With VFP9 this task is more easy.