well, the obvious fix is to use an Inline Table Valued function instead of a scalar function;
i was able to convert it easily, but the example usage you pasted is a subset of the code...i have no idea where the @st value came from, but we'd want to use a column name instead of that variable to speed things up.
CREATE FUNCTION [dbo].[CheckDayType_ITVF]
(@Data SMALLDATETIME)
RETURNS TABLE
AS
RETURN
SELECT
CASE
WHEN Feriado = 0 AND DiaSemana = 1
THEN 0
WHEN Feriado = 0 AND DiaSemana = 0
THEN 1
WHEN Feriado = 1 AND DiaSemana = 1
THEN 2
WHEN Feriado = 1 AND DiaSemana = 0
THEN 3
END AS DayType
FROM dbo.Calendar
WHERE Data = @data
GO
if you can show the fuller code that defines the @st variable, we could help change the code to do a single set based fix
Lowell