• Going slightly off-topic, you may also want to rewrite your function as an itvf and use it with CROSS APPLY in your FROM clause instead of using the scalar function in the SELECT list.

    CREATE FUNCTION [dbo].VAT2 (

    @Net_Amount DECIMAL(25,13),

    @Order_Date [date] )

    RETURNS TABLE WITH SCHEMABINDING

    AS

    RETURN(

    SELECT @Net_Amount *

    CAST(CASE

    WHEN @Order_Date >= '2011-01-04' then 0.200

    WHEN @Order_Date >= '2010-01-01' then 0.175

    WHEN @Order_Date >= '2008-12-01' then 0.150

    WHEN @Order_Date >= '1991-01-01' then 0.175

    WHEN @Order_Date >= '1979-06-18' then 0.150

    WHEN @Order_Date >= '1974-07-01' then 0.080

    WHEN @Order_Date >= '1973-04-01' then 0.100

    ELSE 0.000

    END as DECIMAL(25,13)) AS VatAmt)

    GO