Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Syntax for Stored Procedure
Message
From
06/11/2003 07:00:56
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00846249
Message ID:
00846998
Views:
21
This message has been marked as the solution to the initial question of the thread.
Hi Mariam

>I’m wondering may I use CASE or IF statement in Where clause when I’m writing stored procedure ?

>Is there any way to check inside the procedure if any of parameters is empty ?

You can, as Sergey suggests, test the LEN() of a variable. However, you can also assign default values to the variables in the CREATE PROCEDURE statement like this:
CREATE PROCEDURE dbo.usp_test @corpname varchar(30) = '%', @corpdba varchar(30) = '%'
This has a double benefit and one drawback! The benfits are that you will not get an error if either one or both parameters are omitted, and you don't have to worry about testing them for empty values in the procedure, you can do that in VFP and only pass non-empty values.

The drawback, of course, is that the default condition (both values = '%') will return all rows from the database!
----
Regards
Andy Kramek
Previous
Reply
Map
View

Click here to load this message in the networking platform