Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1885
  • Last Modified:

DatePart - Week - Monday

Hi Experts,

I just got an answer to this question for Access:
http://www.experts-exchange.com/Databases/MS_Access/Q_21864479.html

When I try to apply it to a SQL pass-through query, it doesn't work.  
DatePart('ww',[ProdDate],2,1)

When I tried: DATEPART(ww, ProdDate) I get weeks that begin on Sunday.  

Please advise.  
Scotto13
0
Scotto13
Asked:
Scotto13
  • 2
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
Scotto13,
> When I tried: DATEPART(ww, ProdDate) I get days that begin on Sunday.  
i am note good on Access, what exactly u r intending to do
0
 
JRossi1Commented:
Try the CONVERT function:

DATEPART(ww,CONVERT(varchar(10),ProdDate,101))
0
 
Scotto13Author Commented:
Well, I want weeks that begin Monday.
Also, when I extend to Jan 1, 2007  , I get a week of 53 and week of 1
Please check it out.

I want to return the same result as I get with DatePart('ww',[ProdDate],2,1) in my SQL query
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
SET DATEFIRST 1
select  DATEPART(ww, ProdDate)
SET DATEFIRST 7
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now