Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a conditional 'where' clause
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00226172
Message ID:
00226200
Views:
27
>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
IF gcFunction = '001'
  sqlstate='select * from p1'
ELSE
  sqlstate='select * from p1 where p1_funckey = {gcfunction}'
ENDIF
sqlexec(handle, sqlstate, 'p1')
HTH
Jeff

It's Time to get a gun.

That's what I've been thinkin.

I think I can afford one, If I do a little less Drinkin.

www.TrueGeeks.com
Previous
Reply
Map
View

Click here to load this message in the networking platform