I'm running this query and I believe it first tries to calculate the function and then applies WHERE 1=0 condition. In my case I prefer to not run function at all, of course.
I'll try to figure out later if I can get rid of this query, but is my understanding correct that this function will always execute regardless of the WHERE condition? Is there a way to trick SQL Server to not do unnecessary job?
SELECT SUM(i.QuantityOnHand) AS Quantity,
SUM(i.CostOfGoodsOnHand) AS Ext_Cost,
AVG(i.AverageCost) as Unit_Cost,
('FIFO', '20110520 23:59:59',
'RETAIL ', 'MENSCLOTH ', 'QKSLVSHIRT',
'RETAIL ', 'ME
View Complete Post