[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

How to Format Getdate() for the week?

Experts,

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?

Cheers


0
g118481
Asked:
g118481
1 Solution
 
bwdowhanCommented:
Try this in the where clause:

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

Brian
0
 
g118481Author Commented:
Brian,

Thanks.  This works perfect.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

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