>>I have a VFP query screen that has several text boxes for entry of a the necessary values for a look up by last, first, dob, year of claim, and two case id numbers. In the "Do Query" click code, I create an SQL Select statement which combines the variables based on a useful logic (ie last and first and dob can claim year can be combined using AND logic -- if either of the claim IDs are filled in then the logic is a simple search just on the ID. if "is contained in" is checked the target word is preceded with the %. With SQLEXED, It is a great tool. But the company policy is to use stored procedures.
>>
>>So now I'm trying to implement it as a stored procedure. But I don't have enough experience to write this conditional logic in the stored procedure. If I pass all the query variables to the SP, can I evaluate which ones are non null and conditionally execute one Select statement or another?? If so, how does this procedural code look?
>
>You can use
>
>Isnull( @theParameter, replacementValueIfParameterIsNull)
>
>or:
>
>case when @theParameter is NULL then ... else @theParameter end
>
>T-SQL also supports conditionals like If ... then ... else
>
>Cetin
Can you develop it a little more for me?
For example
Would I be about to conditionally call one SQL Select based on checking for Null parameters and call another SQL Select based on a different combination of Null and Non Null parameters??
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only