Forum Discussion
SET datefirst 1 DirectQuery
- 8 years ago
Thanks guys, i found out the right solution!!
Thanks v-sihou-msft for yuor answer,
I'm trying to get it in my WHERE clause, but what i can find on the internet won't help.
I tried this:
declare @MyDate datetime = getdate()
select
SELECT
CASE WHEN DATEPART(DW,CreatedDateTime) = 1
THEN 7
WHEN DATEPART(DW,CreatedDateTime) <= 7
THEN DATEPART(DW,CreatedDateTime) - 1
END
FROM myDB
WHERE CreatedDateTime >= DATEADD(day, -(DATEPART(dw, GETDATE()) + 6), CONVERT(DATE, GETDATE()))
AND CreatedDateTime < DATEADD(day, 1 - DATEPART(dw, GETDATE()), CONVERT(DATE, GETDATE()))
AND Minutes is not null
AND Minutes > 0
AND TicketNumber like 'CH%'
AND User like 'itsn%'
AND TicketNumber is not null
This won't work, guys got any idea to help me further?
- 1 select ofcourse, typo
- miltenburger8 years agoHelper V
Thanks guys, i found out the right solution!!
- Anonymous3 years agoNot applicable
Do you remember the solution to this problem?