>>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??
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement