How to Format Getdate() for the week?

Posted on 2006-06-05
Last Modified: 2012-05-05

I am using this "Format(Now(),'ww') = Format(C.curdate,'ww')" to format and compare the function Now with a date field, in an app query for MS Access.
I am migrating to SQL Server and need to convert this line in the query.

So far I have "Format(Getdate(),'ww') = Format(C.curdate,'ww')" , but I am getting an error on "Format".
What can I change that to in order for it to work in SQL Server?


Question by:g118481
    LVL 5

    Accepted Solution

    Try this in the where clause:

    where datepart(week,getdate()) = datepart(week,c.currdate)

    LVL 1

    Author Comment


    Thanks.  This works perfect.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    I recently came across an interesting Question In EE ( and was puzzled about how to achieve that using SSIS out of the box tasks, which was i…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Viewers will learn how the fundamental information of how to create a table.
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now