Громоздко, но работает (формат: YYYYMMDD HHMMSS) SELECT LPAD( EXTRACT( YEAR FROM CURRENT_TIMESTAMP ), 4, '0' ) || LPAD( EXTRACT( MONTH FROM CURRENT_TIMESTAMP ), 2, '0' ) || LPAD( EXTRACT( DAY FROM CURRENT_TIMESTAMP ), 2, '0' ) || ' ' || LPAD( EXTRACT( HOUR FROM CURRENT_TIMESTAMP ), 2, '0' ) || LPAD( EXTRACT( MINUTE FROM CURRENT_TIMESTAMP ), 2, '0' ) || LPAD( TRUNC( EXTRACT( SECOND FROM CURRENT_TIMESTAMP ) ), 2, '0' ) FROM RDB$DATABASE Получить номер квартала (1,2,3,4) можно так: SELECT (EXTRACT(MONTH FROM CURRENT_TIMESTAMP)-1)/3+1 as Q FROM RDB$DATABASE А полугодие (1,2) - так: SELECT (EXTRACT(MONTH FROM CURRENT_TIMESTAMP)-1)/6+1 as H FROM RDB$DATABASE
SQL Справочник v0.05 © 2007-2025 Igor Salnikov aka SunDoctor