• There is a potentially big penalty to be paid with using functions in the maner you suggest.

    The problem lies in the fact that functions are in-line by nature. This means that SQL Server will evaluate the function for each row in the table thus resulting in a full table scan.

    Inorder to prevent this you will need to declare a variable that you can assign the value to, e.g

    DECLARE @var

    SET @var = dbo.udf()

    SELECT * FROM sometable WHERE somefield = @var

    Using

    SELECT * FROM sometable WHERE somefield = dbo.udf()

    will give you FTS