• The function - as I'm sure you're going to ask, is solely

    Select @Result=

    Case When @JulianDateToConvert <> 0

    THEN

    dateadd(dd,right(@JulianDateToConvert,3)-1,0)

    +dateadd(yy,left(@JulianDateToConvert,

    case

    when len(@JulianDateToConvert)=5

    then 2

    else 3

    end

    )+0,0)

    ELSE NULL

    END

    I have wondered about this function, and whether that's the cause...but functions don't get cached do they?