>hi all, I need help with this, I want to do a consultation with several parameters in a stored procedure but these parameters do not always have values, but which depends on parameters chosen by the user in vfp I do by creating a variable with the possible selection conditions as follows >cond= cond + "and x condition" and end of the WHERE I put the & cond. but not how to do something the same or similar in sql editor in stored procedure > >for example > >
>cond=''
>if !empty(thisform.txtfecha1.value)
> mfecha=dtos(thisform.txtfecha.value)
> condi=condi+[ and fecha>=']+mfecha1+[']
> sql=[select * from tabla where x>0 &cond]
>endif
>
You will do the same in SQL Server by using dynamic SQL technique.