Blog Archives

SQL Server DatePart Example

select datepart(quarter,getdate()) –Get Week Day Numerical value, Sunday = 1st day of week SELECT   CASE WHEN datepart(weekday,getdate()) = 1 THEN ‘Sunday’ WHEN datepart(weekday,getdate()) = 2 THEN ‘Monday’ WHEN datepart(weekday,getdate()) = 3 THEN ‘Tuesday’ WHEN datepart(weekday,getdate()) = 4 THEN ‘Wednesday’

Tagged with: , , , ,
Posted in SQL Server