I am trying to populate a date table which contains every date for the next 35 years with information regarding each day.
My ERP system has an accounting years table (GLRULE) which specifies the accounting periods for each specific year since many companies do not work on Calendar Months.
The GLRule table contains one record for each period and looks like this:
fcbasis fcname fcstatus fdend fdstart flisadjust flisaudit fnnumber freval identity_column
A FY 2000 C 1/28/2000 0:00:00 1/1/2000 0:00:00 FALSE FALSE 1 FALSE 37
A FY 2000 C 2/25/2000 0:00:00 1/29/2000 0:00:00 FALSE FALSE 2 FALSE 38
A FY 2000 C 3/31/2000 0:00:00 2/26/2000 0:00:00 FALSE FALSE 3 FALSE 39
A FY 2000 C 4/28/2000 0:00:00 4/1/2000 0:00:00 FALSE FALSE 4 FALSE 40
A FY 2000 C 5/26/2000 0:00:00 4/29/2000 0:00:00 FALSE FALSE 5 FALSE 41
A FY 2000 C 6/30/2000 0:00:00 5/27/2000 0:00:00 FALSE FALSE 6 FALSE 42
Anyway, I can update my date table one field at a time with a query similar to this:
UPDATE redfridaydates.dbo.testdates
SET [FISCAL_PERIOD] =
(SELECT fnnumber
FROM m2mdata01..glrule GLR
where DATE >= GLR.FDSTART and DATE <= GLR.FDEND)
Is there a better way to update multiple fields at a time? I'm not sure how I can do so since I do not have a join.