Si8
Si8

Reputation: 9225

Display only WEEKDAY from a range of dates

I have the following queries in my SSRS:

SELECT [ARRIVED DATE]
FROM [DSPCONTENT01].[dbo].[zWMGWEEKARRIVAL]
WHERE [ARRIVED DATE] = DATEPART(weekday,CAST([ARRIVED DATE] as float))

Which is supposed to get the ARRIVED DATE field and only display the weekday dates but I am receiving an Explicit conversion from data type date to float is not allowed

My ARRIVED DATE looks like this:

2014-04-01
2014-04-02
2014-04-03
2014-04-04
2014-04-05
2014-04-06
2014-04-07

How do I modify my script so it only shows the weekday from those dates range.

Upvotes: 0

Views: 97

Answers (1)

JesalynOlson
JesalynOlson

Reputation: 513

You need to modify the where clause to exclude Sunday and Saturday. The SQL server defaults to a Sunday start so the below query should work for you in that case.

SELECT [ARRIVED DATE]
FROM [DSPCONTENT01].[dbo].[zWMGWEEKARRIVAL]
WHERE DATEPART(weekday,[Arrived Date]) NOT IN (1,7)

Upvotes: 1

Related Questions