• I'd like to see an example on when to use that.

    But the thing is, a function is allowed to output a non-deterministic result. It just doesn't support temporary tables which is a different matter. And it doesn't allow side-effects.

    Try this:

    CREATE FUNCTION dbo.FN_WhichDateIsToday()

    RETURNS DATETIME

    AS

    BEGIN

    RETURN(SELECT GETDATE());

    END;

    Thank you for the small hint. 🙂

    Best regards,

    Best regards,

    Andre Guerreiro Neto

    Database Analyst
    http://www.softplan.com.br
    MCITPx1/MCTSx2/MCSE/MCSA