Viewing 2 posts - 1 through 2 (of 2 total)
I agree that it is parameter sniffing, and adding the declare etc to the query makes it run faster.
My next question is, how do I do this in a view...
July 20, 2011 at 4:11 am
#1355451
Here is the general structure of my function:
ALTER FUNCTION [dbo].[fnInventory] (@ClosingDate DateTime )
RETURNS TABLE
AS
RETURN
(
SELECT
*
FROM
InventoryCostUnit WITH (NOLOCK)
LEFT JOIN
SELECT *
FROM BIMovement
WHERE TransactionDateTime...
July 19, 2011 at 8:33 am
#1354855