>I was wondering if there is a way in SQL on SQL7 to say if this variable is
>passed the add a where clause or something......

You can try SQL CASE statements. You will, of course, have to declare the
variables you need in the stored procedure. I have found some performance
issuses with using dynamic sprocs, however. I'm not sure why, but the
execution time can be much greater with the sproc. Might have something to
do with the way SQL server creates the execution plan?

WHERE ........

AND TheDBField = CASE
        WHEN @TheVariable <> 'NO'
        THEN @TheVariable
        ELSE TheDBField

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to