2
Good night!
Guys, I need to know a following result. I want to bring the working days grouped by month and year from April to June of this year 2017. Example:
Ano Mês Dias Uteis
2017 Abril 19
2017 Maio 18
2017 Junho 17
NOTE: There is already a function in our bank called dias_uteis that performs the calculation normally of the working days and holidays. I tried to do with the query below, however, unsuccessfully.
select (dbo.dias_uteis('01-04-2017','30-06-2017')) diasuteis,
DATEPART(month, dbo.dias_uteis('01-04-2017','30-06-2017') ) Mês,
DATEPART(YEAR, dbo.dias_uteis('01-04-2017','30-06-2017')) Ano
group by DATEPART(YEAR, dbo.dias_uteis('01-04-2017','30-06-2017')),
DATEPART(MONTH, dbo.dias_uteis('01-04-2017','30-06-2017'))
What does Function dias_uteis return ? The number of working days of the range ? Your problem and knowing in a month , create a version of this function for this , can use the one that already exists the work would be simple in thesis.
– Motta
Hello, the function is only to bring the working days in any period. In this example I put from April until today.
– Renan Bessa
@Renanbessa: What is the SQL Server version? // How are the parameters set for the dias_uteis function: date? char(10)? other?
– José Diz