How do I exclude Weekend days in a SQL Server query?

前端 未结 7 2401
[愿得一人]
[愿得一人] 2020-11-27 03:20

How do I exclude values in a DateTime column that are Saturdays or Sundays?

For example, given the following data:

date_created
\'2009-1         


        
相关标签:
7条回答
  • 2020-11-27 04:21

    Try the DATENAME() function:

    select [date_created]
    from table
    where DATENAME(WEEKDAY, [date_created]) <> 'Saturday'
      and DATENAME(WEEKDAY, [date_created]) <> 'Sunday'
    
    0 讨论(0)
提交回复
热议问题