As the title says I'm looking for a function in SQL-Server to retrieve all weekdays, based on a variable set as a year.
I know there should be two useful functions for this case, but I don't know how to use them properly nor I am good at writing functions in SQL:
SELECT DATENAME(dw, GETDATE())
and SELECT DATEPART(dw, GETDATE())
I am expecting something like this:
--------------------------
| DATA | GIORNO |
--------------------------
| 01/01/2020 | Wednesday |
--------------------------
| 02/01/2020 | Thursday |
--------------------------
EDIT:
Suraj Kumar gave me a suggestion and I'm stuck here:
DECLARE @date date = getdate();
SELECT FORMAT(@date, 'd') AS DATA
SELECT DATENAME(WEEKDAY, @date) AS GIORNO
What I need to do now is to convert the DATA field to the italian format (day/month/year) and return a table with two field like I've explained before this edit...