Section 12c
Stored Procedures — Record Lifecycle  ·  SQL Server  ·  2026-05-03

12c Stored Procedures — Record Lifecycle

~200 SPs that manage sub-record creation, SEQNO history management (Make*Historical), and sub-record deletion across all ABSD_ table families.

SEQNO History Model

Every ABSD_ history table uses a SEQNO (sequence number) to distinguish the current record from historical ones. The convention is:

Standard Convention (most HI* tables)

SEQNO='00' = current active record
SEQNO='01' = most recent historical
SEQNO='02' = older historical
...

When a new current record is needed, the existing '00' is copied to '01' (and existing '01' → '02', etc.) by a spMake*Historical SP, then the '00' row is updated in-place.

Flag (HIFL) Exception

ABSD_HIFL uses a different scheme: SEQNO='00' = current, SEQNO='95' = most-recent historical. If '95' already exists, the next available sequential number below '95' is used. This allows up to 94 historical flag entries.

The SUPPLEMENTAL_ABSD_HIFL table mirrors this scheme exactly — both rows are always moved together.

Universal Make*Historical Pattern

All spMake*Historical SPs follow one of two patterns depending on the table's SEQNO convention:

Pattern A — Sequential (most tables)

-- 1. Re-sequence: shift all existing history rows up by 1
DECLARE cursor FOR SELECT SEQNO FROM TABLE WHERE LRNO=@L ORDER BY SEQNO DESC
WHILE @@FETCH_STATUS = 0
    UPDATE TABLE SET SEQNO = SEQNO+1 WHERE LRNO=@L AND SEQNO=@CURRSEQNO

-- 2. Copy current '00' → '01'
INSERT INTO TABLE SELECT LRNO, '01', ... FROM TABLE WHERE LRNO=@L AND SEQNO='00'

-- Caller then updates SEQNO='00' in place with new values

Pattern B — HIFL (95-slot)

-- If '95' exists → use MIN(SEQNO)-1 as new slot
-- Else → copy '00' to '95'
-- Always mirror to SUPPLEMENTAL_ABSD_HIFL
Why cursors? The re-sequencing step must process rows from highest SEQNO downward to avoid unique-key violations (e.g. cannot move '02'→'03' while '03' still exists). The DESC cursor ensures each row is safely moved before the next.

spMakeHIFLHistorical — Flag History

spMakeHIFLHistorical @PASSEDLRNO varchar(7)

Archives the current flag (SEQNO='00') to SEQNO='95' (or next available below '95' if '95' exists). Always copies both ABSD_HIFL and SUPPLEMENTAL_ABSD_HIFL rows together (the callsign+MMSI history task added November 2017). The ABSD_HIFL trigger then updates the '00' row in-place with the new flag data.

spMakeHIOWHistorical — Ownership History

spMakeHIOWHistorical @PASSEDLRNO varchar(7)

Archives current owner (ABSD_HIOW SEQNO='00') using Pattern A. Triggers the cascade chain: ABSD_HIOW trigger fires on the update of SEQNO='00', which triggers ABSD_HIPP auto-update, ABSD_OWSH update, and ABSD_OWST recalculation.

spMakeHIPPHistorical / spMakeHIPPDatedHistorical

spMakeHIPPHistorical @PASSEDLRNO varchar(7)
spMakeHIPPDatedHistorical @PASSEDLRNO varchar(7)

ABSD_HIPP (P&I club) has two archiving SPs because of the dual-table design: ABSD_HIPP (current data, simple SEQNO model) and ABSD_HIPP_DATED (dated P&I intervals with start/end date columns). The dated variant preserves the full insurance period dates for historical reporting. spUpdateHIPPDated and spUpdateHIPPHITP are companion SPs for the dated update workflow.

Other HI* Historical SPs

All follow Pattern A unless noted. Each SP handles exactly one table:

SPTableArchives
spMakeHIBBCHistoricalABSD_HIBBCBareboat charter history
spMakeHIBRHistoricalABSD_HIBRSurvey/rebuild history
spMakeHIDEHistoricalABSD_HIDEDeletion history (soft archiving)
spMakeHIDRHistoricalABSD_HIDRDraft/freeboard history
spMakeHIFC2HistoricalABSD_HIFC2Class notation history
spMakeHIGBOHistoricalABSD_HIGBOGross/beneficial owner history
spMakeHIGEHistoricalABSD_HIGEElectrical generation history
spMakeHILCHistoricalABSD_HILCLR class history
spMakeHILEHistoricalABSD_HILELoad-line history
spMakeHIMAHistoricalABSD_HIMAShip manager history
spMakeHIMOHistoricalABSD_HIMOMain engine history
spMakeHIOPHistoricalABSD_HIOPOperator history
spMakeHIPRHistoricalABSD_HIPRPort registry history
spMakeHISMHistoricalABSD_HISMShip manager (ISM) history
spMakeHISTHistoricalABSD_HISTStatus history
spMakeHITLHistoricalABSD_HITLTonnage/LDT history
spMakeHITPHistoricalABSD_HITPTechnical manager history
spMakeHITSHistoricalABSD_HITSSurvey status history
spMakeHITTHistoricalABSD_HITTTechnical type history

OV* Historical SPs

SPTableNotes
spMakeOVDOCArchivedABSD_OVDOCArchives DOC certificate to historical state. Companion: spUpdateCurrentDOC to update active record.
spMakeOVISSCArchivedABSD_OVISSCArchives ISM Safety Management Certificate (ISSC). Companion: spUpdateCurrentISSC.
spMakeOVNAHistoricalABSD_OVNAArchives current name record. The ABSD_OVNA_Update trigger fires on the '00' update that follows.
spMakeOVSMCArchived / spMakeOVSMCHistoricalABSD_OVSMCTwo variants: Archived marks for removal from live output; Historical preserves in history chain.
spMakeOVTYHistoricalABSD_OVTYArchives ship type record when type changes. Triggers APS type narrative regeneration.
spUpdateOVNAHistoricalABSD_OVNAUpdates historical OVNA records (e.g. to correct a past name entry).

spMakeSALEHistorical / spMakeSALEHistoricalWithPrice

spMakeSALEHistorical @PASSEDLRNO varchar(7)
spMakeSALEHistoricalWithPrice @PASSEDLRNO varchar(7), @TOTAL_SCRAP_PRICE int

Archives the current ABSD_Sale record (SEQNO='00') to SEQNO='01'. The WithPrice variant additionally inserts the computed scrap price into SUPPLEMENTAL_ABSD_CADI before archiving — this is part of the scrap price triangle (SUPPLEMENTAL_ABSD_HITL LDT change → SUPPLEMENTAL_ABSD_CADI.TOTAL_SCRAP_PRICE update → new ABSD_Sale record creation). Called by the SUPPLEMENTAL_ABSD_CADI trigger.

All Make*Historical — Quick Reference

SP NameTarget TablePattern
spMakeCOMPDATEHistoricalSUPPLEMENTAL_ABSD_STSE_COMPDATEA
spMakeForClassHistoricalABSD_FOR_CLASSA
spMakeHIBBCHistoricalABSD_HIBBCA
spMakeHIBRHistoricalABSD_HIBRA
spMakeHIDEHistoricalABSD_HIDEA
spMakeHIDRHistoricalABSD_HIDRA
spMakeHIFC2HistoricalABSD_HIFC2A
spMakeHIFLHistoricalABSD_HIFL + SUPPLEMENTAL_ABSD_HIFLB (95-slot)
spMakeHIGBOHistoricalABSD_HIGBOA
spMakeHIGEHistoricalABSD_HIGEA
spMakeHILCHistoricalABSD_HILCA
spMakeHILEHistoricalABSD_HILEA
spMakeHIMAHistoricalABSD_HIMAA
spMakeHIMOHistoricalABSD_HIMOA
spMakeHIOPHistoricalABSD_HIOPA
spMakeHIOWHistoricalABSD_HIOWA
spMakeHIPPDatedHistoricalABSD_HIPP_DATEDA + date columns
spMakeHIPPHistoricalABSD_HIPPA
spMakeHIPRHistoricalABSD_HIPRA
spMakeHISMHistoricalABSD_HISMA
spMakeHISTHistoricalABSD_HISTA
spMakeHITLHistoricalABSD_HITLA
spMakeHITPHistoricalABSD_HITPA
spMakeHITSHistoricalABSD_HITSA
spMakeHITTHistoricalABSD_HITTA
spMakeMAAUHistorical (via spDeleteMAAU)ABSD_MAAUdelete-only
spMakeMABOHistoricalABSD_MABOA
spMakeMABUHistoricalABSD_MABUA
spMakeMAPRHistoricalABSD_MAPRA
spMakeNewLRSCABSD_LRSCInsert new (not archive)
spMakeNewLRSusABSD_LRSUInsert new
spMakeNewLRWDABSD_LRWDInsert new
spMakeNewOVCAABSD_OVCARe-sequence + insert
spMakeNewTankCoatABSD_TANKERInsert tank coating entry
spMakeOVDOCArchivedABSD_OVDOCStatus-flag archive
spMakeOVISSCArchivedABSD_OVISSCStatus-flag archive
spMakeOVNAHistoricalABSD_OVNAA
spMakeOVSMCArchivedABSD_OVSMCStatus-flag archive
spMakeOVSMCHistoricalABSD_OVSMCA
spMakeOVTYHistoricalABSD_OVTYA
spMakeOWDCExpiredHistoricalABSD_OWDCExpire-date based archive
spMakeOWDCHistoricalABSD_OWDCA
spMakePandIHistoricalABSD_PANDIA
spMakeSALEHistoricalABSD_SaleA
spMakeSALEHistoricalWithPriceABSD_Sale + SUPPLEMENTAL_ABSD_CADIA + scrap price
spMakeShipWatchtblShipWatchInsert watch entry
spMakeSPTMHistoricalABSD_SPTMA
spMakeSTALHistoricalABSD_STALA
spMakeTechManHistoricalABSD_TECH_MANA
spMakeTHIRDPARTYHistoricalABSD_THIRD_PARTY (legacy)A

spCreateNewOVSMC / spCreateNewOVDOC / spCreateNewISSC

spCreateNewOVSMC @PASSEDLRNO varchar(7)
spCreateNewOVDOC @PASSEDLRNO varchar(7)
spCreateNewISSC @PASSEDLRNO varchar(7)

Creates a placeholder safety management certificate record with defaults:

Related update SPs: spSMC_ReplaceExpiredIntrim, spSMCToArchive, spSMCBlank_AfterHist, spDOCToArchive, spOVDOC_ReplaceExpiredIntrim, spOVDOC_UpdateFromExpiredSMC, spISSCToArchive, spISSCBlank_AfterHist.

spCreateNewSale / spCreateNewSaleWithPrice

spCreateNewSale @PASSEDLRNO varchar(7)
spCreateNewSaleWithPrice @PASSEDLRNO varchar(7), @TOTAL_SCRAP_PRICE int

spCreateNewSale — Inserts a blank ABSD_Sale record (SEQNO='00', SALE_EFD=today in YYYYMMDD, SALE_PRICE_USD=null).

spCreateNewSaleWithPrice — Same but also sets SALE_PRICE_USD=@TOTAL_SCRAP_PRICE. This is the endpoint of the scrap price triangle: called by the SUPPLEMENTAL_ABSD_CADI trigger when LDT × (AMNT/100) has been computed.

spCreateNewCompany / spCreateNewCompanyEDM

spCreateNewCompany @CompanyName varchar(100), @CountryCode varchar(3), @CompanyType varchar(2) = 'OW' [... additional address params]
spCreateNewCompanyEDM @CompanyName varchar(100), @EDMEntityID int [...]

spCreateNewCompany — Creates the full company record suite:

spCreateNewCompanyEDM — Variant that links the new ABSD company record to an existing EDM (Entity Data Master) entity by EDM entity ID. Used during the partial EDM migration to ensure ABSD and EDM company records stay in sync.

spCreateNewAuxEngine

spCreateNewAuxEngine @PASSEDLRNO varchar(7), @EngineType varchar(2)='09'

Creates a new auxiliary engine entry in ABSD_MAAU. Assigns the next available SEQ_NO for the given LRNO (auxiliary engines are multi-row, keyed by LRNO+ENG_TYPE+SEQ_NO). Inserts a placeholder row with all unknown/default values. The ABSD_MAAU_Update trigger fires to validate engine type codes and update ABSD_SHIP_SEARCH.

spCreateNewFUSF2 / spAddDeleteFUSF2 / spDeleteFUSF2

spCreateNewFUSF2 @PASSEDLRNO varchar(7), @FEATURECODE varchar(5)
spAddDeleteFUSF2 @PASSEDLRNO varchar(7), @FEATURECODE varchar(5), @Action char(1)
spDeleteFUSF2 @PASSEDLRNO varchar(7), @FEATURECODE varchar(5)

ABSD_FUSF2 stores special feature codes (e.g. 'DP2' for Dynamic Positioning class 2, 'HS' for helipad). Each feature is a separate row keyed by LRNO+FEATURECODE.

spCreateNewLRSC / spCreateNewLRSU / spCreateNewLRWD

spCreateNewLRSC @PASSEDLRNO varchar(7), @CertType varchar(2)='01'
spCreateNewLRSU @PASSEDLRNO varchar(7)
spCreateNewLRWD @PASSEDLRNO varchar(7)

LR-specific certificate management:

Other spCreateNew* — Quick Reference

SP NameCreates
spCreateNewBBCABSD_HIBBC bareboat charter record
spCreateNewBreakerBreaker (demolition yard) company record
spCreateNewBuilder / spCreateNewBuilderYardShipbuilder company + yard records
spCreateNewCACOABSD_CACO casualty code entry
spCreateNewCACTABSD_CACT casualty certificate entry
spCreateNewCADIABSD_CADI casualty detail record
spCreateNewCAGE2ABSD_CAGE2 casualty event sub-record
spCreateNewCALAABSD_CALA casualty location record
spCreateNewCAPRABSD_CAPR casualty person record
spCreateNewCombinationCodeABSD_CBEB combination type code entry
spCreateNewFlexBucketCBEntryABSD_CBEB flex bucket entry
spCreateNewFlexBucketEntryGeneric flex bucket table entry
spCreateNewForClassABSD_FOR_CLASS foreign classification entry
spCreateNewHIFC2ABSD_HIFC2 LR class notation row
spCreateNewHullSectionABSD_STSE hull construction section row
spCreateNewMetaDatatblMetaData record for vessel metadata
spCreateNewNEWCONABSD_NCON newbuild order record
spCreateNewOWAD1 / spCreateNewOWAD2Company address records (ABSD_OWAD1/2)
spCreateNewOWCNABSD_OWCN company comms record
spCreateNewOWCOABSD_OWCO company officer record
spCreateNewOWDCABSD_OWDC company document/certificate
spCreateNewPersonnelCompany personnel record
spCreateNewPLANVessel plan/drawing record
spCreateNewSBRPOSSBR position record for AIS data
spCreateNewSMCABSD_OVSMC safety management certificate
spCreateNewSomethingGeneric/stub create SP for testing
spCreateOWSHABSD_OWSH ownership-ship relationship record
spCreateOVSMCAnno / spCreateOVSMCEmailSentAnnoOVSMC-specific annotation entries
spCreateBlankOVISSCABSD_OVISSC blank ISSC record
spCreateNewOVSMC_CaptivaOVSMC from Captiva document scanning workflow

spDelete* Pattern

All sub-record delete SPs follow this pattern:

CREATE PROCEDURE spDeleteXxx
    @PASSEDLRNO VARCHAR(7),
    @PASSEDSEQNO VARCHAR(2) = NULL  -- or INNO/other key
AS
    BEGIN TRANSACTION
    DELETE FROM ABSD_Xxx
        WHERE LRNO = @PASSEDLRNO
        AND  SEQNO = @PASSEDSEQNO   -- or other key condition
    -- For SUPPLEMENTAL_ mirrored tables: also DELETE from SUPPLEMENTAL_
    -- Write tblChanges annotation
    COMMIT TRANSACTION

Historical records (non-'00' SEQNOs) can be deleted by their specific SEQNO. The current ('00') record is generally not deleted directly — instead spMake*Historical is called first and then the '00' is updated with new values.

Ownership Delete SPs

SPDeletesNotes
spDeleteHIOWHistoricalABSD_HIOW historical rowOnly deletes non-'00' SEQNOs
spDeleteHIMAHistoricalABSD_HIMA historical row
spDeleteHIPPHistoricalABSD_HIPP historical row
spDeleteHIPP_DATEDHistoricalABSD_HIPP_DATED historical rowAlso updates ABSD_OWSH timeline
spDeleteHITPHistoricalABSD_HITP historical row
spDeleteHISMHistoricalABSD_HISM historical row
spDeleteHIGBOHistoricalABSD_HIGBO historical row
spDeleteOWanABSD_OWAN owner annotation
spDeleteOWAD1 / spDeleteOWAD2Company address recordsAlso clears ABSD_OWSH address links
spDeleteOWCNCompany comms record
spDeleteOWCOCompany officer record
spDeleteOWDC / spDeleteOWDCHistoryCompany document records
spDeleteOWNACompany name record
spDeleteOWSHABSD_OWSH ownership-ship linkRe-runs OWST recompute
spDeleteOWXRABSD_OWXR cross-reference record
spDeleteCompanyAll company records for an OWCODEFull company deletion (irreversible)

FU* Delete SPs

SPDeletes
spDeleteFUCA2ABSD_FUCA2 cargo capacity row
spDeleteFUCO2ABSD_FUCO2 consumable/fuel row
spDeleteFUDI2ABSD_FUDI2 dimension row
spDeleteFUDO2ABSD_FUDO2 door/ramp row (BOW/SID/STN)
spDeleteFUHA2 / spDeleteFUHA2C / spDeleteFUHA2WABSD_FUHA2 hatch rows (container/weather types)
spDeleteFULI2ABSD_FULI2 lifting equipment row
spDeleteFURO2ABSD_FURO2 propulsion row
spDeleteFUSF2ABSD_FUSF2 special feature code
spDeleteFUSPABSD_FUSP speed/power data row
spDeleteFUST2ABSD_FUST2 stability row
spDeleteFUUN2ABSD_FUUN2 unit capacity row

All spDelete* — Complete Reference

Alphabetical listing of all 70+ delete SPs. All follow the standard pattern: DELETE the specific row, then write a tblChanges annotation. Many also clean up SUPPLEMENTAL_ mirror tables.

SPTarget
spDeleteABSDCBCO_NOTEABSD_CBCO note field
spDeleteAUX_ENG_MANAuxiliary engine manufacturer link
spDeleteCACOABSD_CACO casualty code
spDeleteCAGE2ABSD_CAGE2 casualty sub-event
spDeleteCasualtyFull casualty record suite for an INNO
spDeleteCOMPDATEHistoricalSUPPLEMENTAL_ABSD_STSE_COMPDATE historical
spDeleteDOVessel document order entry
spDeleteFlexBucketEntryABSD_CBEB flex bucket row
spDeleteForClassABSD_FOR_CLASS foreign class entry
spDeleteHIBBCHistoricalABSD_HIBBC historical row
spDeleteHIBRHistoricalABSD_HIBR historical row
spDeleteHIDEHistoricalABSD_HIDE historical row
spDeleteHIDRHistoricalABSD_HIDR historical row
spDeleteHIFC2ABSD_HIFC2 notation row (current)
spDeleteHIFC2HistoricalABSD_HIFC2 historical row
spDeleteHIFLHistoricalABSD_HIFL historical + SUPPLEMENTAL
spDeleteHIGEHistoricalABSD_HIGE historical row
spDeleteHILCHistoricalABSD_HILC historical row
spDeleteHILEHistoricalABSD_HILE historical row
spDeleteHIMOABSD_HIMO main engine (current)
spDeleteHIMOHistoricalABSD_HIMO historical row
spDeleteHIMTHistoricalABSD_HIMT historical row
spDeleteHIOPHistoricalABSD_HIOP historical row
spDeleteHIOWHistoricalABSD_HIOW historical row
spDeleteHIPMHistoricalABSD_HIPM historical row
spDeleteHIPPHistoricalABSD_HIPP historical row
spDeleteHIPP_DATEDHistoricalABSD_HIPP_DATED historical row
spDeleteHIPRHistoricalABSD_HIPR historical row
spDeleteHISMHistoricalABSD_HISM historical row
spDeleteHISTHistoricalABSD_HIST historical row
spDeleteHITLHistoricalABSD_HITL historical row
spDeleteHITPHistoricalABSD_HITP historical row
spDeleteHITSHistoricalABSD_HITS historical row
spDeleteHITTHistoricalABSD_HITT historical row
spDeleteLRSC / spDeleteLRSU / spDeleteLRWDLR certificate rows
spDeleteMAAUABSD_MAAU aux engine row
spDeleteMABO / spDeleteMABOHistoricalABSD_MABO boiler rows
spDeleteMABU / spDeleteMABUHistoricalABSD_MABU breadth rows
spDeleteMAPR / spDeleteMAPRHistoricalABSD_MAPR propulsion rows
spDeleteMATHABSD_MATH thrusters row
spDeleteNCONConfiABSD_NCON confidential newbuild record
spDeleteOVCAABSD_OVCA casualty header (current)
spDeleteOVDOCHistoricalABSD_OVDOC historical DOC row
spDeleteOVISSCHistoricalABSD_OVISSC historical ISSC row
spDeleteOVNAHistoricalABSD_OVNA historical name row
spDeleteOVSMCABSD_OVSMC SMC record
spDeleteOVSMCHistoricalABSD_OVSMC historical row
spDeleteOVTYHistoricalABSD_OVTY historical type row
spDeletePandIHistoricalABSD_PANDI historical P&I row
spDeletePersonnelCompany personnel record
spDeleteSaleCurrentABSD_Sale current ('00') row
spDeleteSaleHistoricalABSD_Sale historical row
spDeleteShipFull vessel record (all 62 tables — see 12b)
spDeleteShip_N_StatusShips with specific status codes (admin cleanup)
spDeleteSPANABSD_SPAN annotation span record
spDeleteSPTMABSD_SPTM survey period record
spDeleteSPTMHistoricalABSD_SPTM historical row
spDeleteSTALHistoricalABSD_STAL stability historical row
spDeleteSTSEABSD_STSE hull section row
spDeleteTankCoatABSD_TANKER coating entry
spDeleteTechManABSD_TECH_MAN technical manager record
spDeleteTHIRDPARTYHistoricalLegacy THIRD_PARTY historical row
Section 12c  ·  LR Maritime Database Documentation  ·  2026-05-03