>
> I wish to move this query into MSSQL server for performance reasons, how do
> I go about running the conditional code?  I have tried...
>

I'm not sure you are going to get the performance benefit you are
looking for.  Doing the conditional processing in SQL isn't
necessarily going to be faster...but you could do...

DECLARE @productgroupid bigint;
SET @productgroupid = 5;
SELECT Title, ProductID
FROM aTable
WHERE   Stock > 0
AND ProductGroupID = CASE WHEN @productgroupid > 0 THEN
@productgroupid ELSE ProductGroupID END

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280801
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to