Skip to content
Advertisement

date_trunc month in SQL Server

I want to extract the “month” from the date_contact column. I tried select dateadd(mm, datediff(mm,0, date_contact), 0) from cohort and select cast(date_contact As Date). I received result that is same as date from the first method. And for the second method I got error message: date_contact is not a valid name.

enter image description here

Advertisement

Answer

aka..

or…

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement