Reputation: 759
Is it possible to make a SQL Server query like this:
Select *
From table
Where GetDayOfWeekId(DateColumn) = 1
DateColumn
has a string value like 2014-04-18
Is there a function that can extract a day name or an id to use in the where clause?
Upvotes: 0
Views: 112
Reputation: 452
If I undestand you need:
Select * From table Where DATEPART(weekday,DateColumn) = 1
Upvotes: 0
Reputation: 28781
Select * From table Where DATENAME(dw,DateColumn) = 'Monday'
Select * From table Where DATEPART(dw,DateColumn) = 1
More DATE info extracting Functions
Upvotes: 2