Monday, March 12, 2012

Function to determine weekoftheyear.

I looking a function to determine the w of the year. In excel I use
WNum, but I need this for sql server.
thank you.select DATEPART(wk,getdate())
or
select DATEPART(ww,getdate())
"Miguel Arenas" wrote:

> I looking a function to determine the w of the year. In excel I use
> WNum, but I need this for sql server.
> thank you.|||Both work.
MattB wrote:
> select DATEPART(wk,getdate())
> or
> select DATEPART(ww,getdate())
> "Miguel Arenas" wrote:
>|||SQL Server w is different than the ISO w
Do a search for FUNCTION dbo.ISOw, you can also find the code here
(http://msdn2.microsoft.com/en-us/library/ms186755.aspx) if you scroll
down
Denis the SQL Menace
http://sqlservercode.blogspot.com/
MattB wrote:
> select DATEPART(wk,getdate())
> or
> select DATEPART(ww,getdate())
> "Miguel Arenas" wrote:
>

No comments:

Post a Comment