Number of Weeks between 2 Dates in SQL Server and Oracle

Posted on Microsoft .NET Support Team See other posts from Microsoft .NET Support Team
Published on Wed, 20 Oct 2010 02:45:00 +0000 Indexed on 2011/01/11 9:57 UTC
Read the original article Hit count: 276

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('12/31/9999','mm/dd/yyyy')
              - to_date('01/01/1753','mm/dd/yyyy')
             )
             / 7) diff
FROM DUAL;

© Microsoft .NET Support Team or respective owner

Related posts about .NET Code Samples

Related posts about .NET Interview questions