Sreekumar P
Sreekumar P

Reputation: 6050

How can I get the Week Index (SUN-0....)

How can I get the Week Index like this

from SQL Server.

I have used this

SELECT DATENAME(W,GETDATE())

But this will return the name as "Friday"

Thanks..

Upvotes: 0

Views: 185

Answers (1)

Mikael Eriksson
Mikael Eriksson

Reputation: 138990

set datefirst 7
select datepart(dw, getdate())-1

SET DATEFIRST

DATEPART

Upvotes: 2

Related Questions