Fernando,
>I like this one.
IMO it's the easiest and most portable solution, but not necessarily the fastest as Sergey mentioned. But it should be ok!
>Below is the next "version" of SQLSeek, with your sugestions:
> IIf (! Empty (pWhereCondition), " Where " + pWhereCondition, "")
Will there really be situations where you will pass an empty "seek" expression and want the Select executed when you do that? Just wondering about the IIF in the Select instead of an IF around the whole code inside the procedure ...
>Thanks!
You're welcome! Glad I could be of help ... and ... congratulations for Brasil's success at the soccer world cup :)
>
> Procedure SQLSeek
>*--------- -------
> LParameters pHandle , pTable, pWhereCondition
> Local cOldAlias, bFound, cSelectStr
>
> cOldAlias = Select ()
>
> cSelectStr = "Select Count (*) as SeekCount From " + pTableName +
> IIf (! Empty (pWhereCondition), " Where " + pWhereCondition, "")
>
> SqlExec (pHandle, cSelectStr, "CurSQLSeek")
>
> Select CurSQLSeek
>
> bFound = SeekCount > 0
>
> Use In CurSQLSeek
>
> Select (cOldAlias)
>
> Return bFound
>
> EndProc
>