Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Wednesday, October 20, 2010

Number of Weeks between 2 Dates in SQL Server and Oracle

This post gives you queries in Oracle and SQL Server to find number of weeks between 2 given dates Microsoft SQL Server Syntax:

SELECT DATEDIFF (ww, '01/01/1753', '12/31/9999');

Oracle Syntax:

SELECT floor(
              - to_date('01/01/1753','mm/dd/yyyy')
             / 7) diff

Post a Comment