Category Archives: Code

How to Reset Zend Server Statistics

By | Quick Tips, SQL, sqlite, Zend, Zend Server | No Comments

Reset Zend Server Statistics

I had to work this one out myself, hopefully this will save you some time:

sudo rm /usr/local/zend/var/db/statistics.db
sudo sqlite3 statistics.db < /usr/local/zend/share/statistics_sqlite_create_database.sql
sudo sqlite3 statistics.db < /usr/local/zend/share/stats_sqlite_fixtures.sql

TSQL Date Only Function

By | Code, Database, MSSQL2005, MSSQL2008, Quick Tips, Software Development, SQL Server, TSQL | No Comments
CREATE FUNCTION [dbo].[DateOnly] (@DATE DATETIME)
RETURNS DATETIME
BEGIN
    RETURN DATEADD(d, DATEDIFF(d, 0, @DATE), 0)
END

TSQL Last Day Of The Month

By | Code, MSSQL2005, MSSQL2008, Quick Tips, SQL Server, TSQL | No Comments
CREATE FUNCTION [dbo].[LastDayOfTheMonth] (@DATE DATETIME )
RETURNS DATETIME
BEGIN
    RETURN dateadd(ms, -3, DATEADD(mm, DATEDIFF(m, 0, @DATE) + 1, 0))
END