Mahmoud AlSaadi gives us a Fiscal Period Setup – SQL Script.
Dynamics GP Essentials: Fiscal Period Setup – SQL Script
SQL & DataDevelopment & IntegrationGeneral Ledger & Financials
Archived post from 2014. Dynamics GP and the links it points to have changed since; check current documentation before relying on version-specific steps.