3
Answers

datepart/datename

Rodney Johnson

Rodney Johnson

13y
1.9k
1
Hello,

I have a table containing the following columns
TrailerID ScheduleDate ActualDate
AcutalCube

     
I would like to pull the trailerID if the day of the week is, say Tuesday.  I have found I can get the day of the week for a specific row using datepart, however I would like to pull all rows for a given day of the week.  I have tried the following

select * from summary where datepart(dw, ' ') = '5'.  (the name of the table is "summary".)

The query executes successfully with 0 rows.  The results of the query are to be pulled into C# and then put into a structure for further manipulation.  If I can avoid pulling all of the rows in sql then altering it in C# to only those I want that would be wonderful.


Answers (3)