How to call a function in another Function
<p>I need to write a script that creates and calls a function named <code>fnItemTotal</code> that calculates the total amount of an item in the <code>OrderItems</code> table (discount price multiplied by quantity). </p>

<p>To do that, this function should accept one parameter for the item ID, it should use the DiscountPrice function that I created earlier and it should return the value of the total for that item. </p>

<hr>

<p>This is my Function I created and it gets created. But when i try to call it it gives an error.</p>

<pre><code>CREATE FUNCTION fnItemTotal 
        (@ItemID INT )
    RETURNS MONEY
BEGIN
RETURN 
    (
        SELECT 
            ItemId,
            (SELECT * FROM dbo.fnDiscountPrice(ItemID) WHERE ItemID=@ItemID)*Quantity)--The fnDiscountPrice is the Other function i created.
        FROM 
            OrderItems
        WHERE 
            ItemID=@ItemID
    );
END 
GO
</code></pre>

<hr>

<p>This is what I'm using to call it:</p>

<pre><code>Select ItemID,dbo.fnItemTotal(ItemID) AS 'Total Price'
from OrderItems 
ORDER BY ItemID;
</code></pre>

<hr>

<p>This is the ERROR it gives me when I call it:</p>

<blockquote>
  <p>Msg 208, Level 16, State 3, Line 2
  Invalid object name 'dbo.fnDiscountPrice'.</p>
</blockquote>