mirror of
https://github.com/acedanger/budget-database.git
synced 2025-12-05 22:50:13 -08:00
moving to postgres
This commit is contained in:
22
mysql/procedures/proc_UpdateHolidaysTable.sql
Normal file
22
mysql/procedures/proc_UpdateHolidaysTable.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
use Leo
|
||||
go
|
||||
|
||||
alter proc dbo.proc_UpdateHolidaysTable
|
||||
as
|
||||
if not exists(select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'HOLIDAYS')
|
||||
create table dbo.HOLIDAYS(dt date primary key clustered, Holiday varchar(50))
|
||||
|
||||
declare @year int = 2019
|
||||
|
||||
while @year < year(getdate()) + 40
|
||||
begin
|
||||
insert into dbo.Holidays(dt, Holiday)
|
||||
select fhol.dt, fhol.Holiday
|
||||
from
|
||||
dbo.tvf_GetHolidays(@year) fhol
|
||||
left join dbo.Holidays tbh on fhol.dt = tbh.dt
|
||||
where fhol.dt is null
|
||||
|
||||
set @year = @year + 1
|
||||
end
|
||||
go
|
||||
Reference in New Issue
Block a user