SQL Server – Calculating Business Days Between Two Dates (With Holiday Exclusion)

Note: The post is the same as the previous one for Oracle but this is for SQL Server. Although the date arithmetic gets a little complicated by the SQL Server syntax, the concept is the same. If you search the web on how to calculate the number of business days between two dates in SQL … Continue reading SQL Server – Calculating Business Days Between Two Dates (With Holiday Exclusion)

Advertisements

Oracle – Find Hard-coded Dates In PL/SQL Code Using Regular Expressions

Recently a situation came up in PL/SQL code where the format specifier for date was misplaced. Oracle did not complain because it can implicitly convert strings to date. It may not even fail at run-time under most circumstances (always recommend using an explicit format specification though). This is the SQL ..but the Developer meant this: … Continue reading Oracle – Find Hard-coded Dates In PL/SQL Code Using Regular Expressions

Oracle Tip – Generate “N” rows of dates or numbers serially

Sometimes, you would have a situation where you need to generate a table with N number of rows that you can use as the basis to join and restrict other tables. For example, to get the 100 dates starting from a certain date as rows, a typical technique is to select ROWNUM from all_objects to … Continue reading Oracle Tip – Generate “N” rows of dates or numbers serially