It may be necessary to integrate the several elements of the date into one. In such cases, SQL Server’s DATEFROMPARTS function will come in handy.
Let’s have a look at how it works.
SELECT DATEFROMPARTS(2022,1,1)
Returns “2022-01-01”
SELECT DATEFROMPARTS(2022,1,25)
Returns “2022-01-25”
SELECT DATEFROMPARTS(2022,1,30)
Returns “2022-01-30”
SELECT DATEFROMPARTS(2022,1,31)
Returns “2022-01-31”
Hope you find this article helpful.
Please subscribe for more interesting updates.
2 comments