>I am trying to create a remote view (from SQL Server back end) that would emulate the following Passthrough code:
>
>
IF gcFunction = '001'
> sqlexec(handle, 'select * from p1', 'p1')
>ELSE
> sqlexec(handle, 'select * from p1 where p1_funckey = {gcfunction}', 'p1')
>ENDIF
>
>In other words, I want all records if the value of gcFunction is '001', otherwise I want to filter for p1_funckey equaling the value of gcFunction. I have already tried a variety of IIF() constructs in the where clause, but that doesn't work. How do I do this?
>
>Thanks
Hi Valerie,
I cannot check on SQL Server, but in pure VFP SQL SELECT if your gcFunction returns an '' (empty string) you will get all the records in the resulting cursor.
Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison