Month: March 2018

  • Get rows count of the tables – Microsoft SQL Server

    [sql] CREATE TABLE #counts ( table_name varchar(255), row_count int ) EXEC sp_MSForEachTable @command1=’INSERT #counts (table_name, row_count) SELECT ”?”, COUNT(*) FROM ?’ SELECT table_name, row_count FROM #counts ORDER BY table_name, row_count DESC DROP TABLE #counts [/sql]

  • Get last and current quarter in javascript

    [js] function getQuarter(id) { var d = new Date(); var quarter = Math.floor((d.getMonth() / 3)); switch (id) { case “Current”: var firstDate = new Date(d.getFullYear(), quarter * 3, 1); var endDate = new Date(firstDate.getFullYear(), firstDate.getMonth() + 3, 0); break; case “Previous”: var firstDate = new Date(d.getFullYear(), quarter * 3 – 3, 1); var endDate =…