12e Stored Procedures — External Data & System
PSC port-state-control loaders (11 MOU sources), OFAC/UN sanctions integrations, data loading pipelines (Janes, SBR, AIS, MSC), production output SPs (APS, NB Email, EDM), codebook row-source SPs (80+), and DBA tooling (Spot_* diagnostics, Fog_* performance monitors).
PSC Pipeline Overview
Port State Control (PSC) inspection data from 11 MOU regional bodies is loaded into ABSD_INSPECTION_VISITS, ABSD_DEFECT, and ABSD_DETENTION. Each source has a three-SP set: Insert, Update, Delete — totalling ~60 PSC SPs.
spPSC_Delete_*) removes records no longer present in the latest extract. Each source's extract file is compared against the existing ABSD data using the source reference key.PSC Insert / Update / Delete Pattern
-- Insert pattern
CREATE PROCEDURE spPSC_Insert_ParisMOU
AS
INSERT INTO ABSD_INSPECTION_VISITS (LRNO, SOURCE, INSPECTION_DATE, PORT_CODE, RESULT, ...)
SELECT d.LRNO, 'PARIS', d.InspDate, d.Port, d.Result, ...
FROM tblDetentionsTempParis d -- staging table pre-loaded from extract
LEFT JOIN ABSD_INSPECTION_VISITS v
ON v.SOURCE = 'PARIS' AND v.SOURCE_REF = d.SourceRef
WHERE v.SOURCE_REF IS NULL -- no existing record → new
The staging table (e.g. tblDetentionsTempParis) is populated by a preceding spCreateDetentionsTemp* SP which parses the raw file, resolves LRNOs via ABSD_SHIP_SEARCH, and applies basic format normalisation. The spPSC_Delete_* SPs then remove any ABSD records for the source that were NOT in the latest extract (indicates the MOU has corrected/removed them).
PSC Sources (11 MOU Bodies)
| Source | SP Prefix | Notes |
|---|---|---|
| Paris MOU | spPSC_*_ParisMOU | Largest source. Both XML and legacy flat-file variants: spPSC_Insert_ParisMOU_XML, spPSC_Insert_ParisMOU_XML_Certs, spPSC_Insert_ParisMOU_XML_Extras. Daily delta loader: spPSC_Insert_ParisMOU_Daily. Also spParisMOU_DetentionsDataPUCKER for PUCKER deduplication. spInsertIntoTblPSC_Daily_ParisDetentions_Download for the daily parking table. |
| Tokyo MOU | spPSC_*_TokyoMOU | Daily variant: spPSC_Insert_TokyoMOU_Daily / spPSC_Daily_Tokyo_LoadDefects |
| USCG | spPSC_*_USCG | USCG extra fields: spPSC_Delete_USCG_Extra |
| AMSA (Australia) | spPSC_*_AMSA | Certificate: spCreateCertificateTempAMSA, Deficiency: spPopulate_AMSA_DEFICIENCY, Inspection: spPopulate_AMSA_INSPECTION_VISIT |
| Black Sea MOU | spPSC_*_BlackSea | Daily delta: spPSC_Insert_BlackSea_Daily / spPSC_Daily_BlackSea_LoadDefects |
| Caribbean MOU | spPSC_*_CaribbeanMOU | New format variant: spPSC_*_CaribbeanMOU_new |
| Indian Ocean MOU | spPSC_*_IndianOcean | Extras: spCreatePopulate_ABSD_INSPECTION_EXTRAS_IndianOcean, spCreatePopulate_ABSD_PSC_CERTIFICATE_IndianOcean |
| Mediterranean MOU | spPSC_*_MedMOU | |
| Riyadh MOU | spPSC_*_RiyadhMOU | |
| VDM (Vetting) | spPSC_*_VDM | Deletes: spDeleteVDMDefects / spDeleteVDMInspections |
| Paris Daily (batch) | spPSC_Daily_Paris_LoadDefects | Loads defect detail from daily Paris download |
PSC Daily Load SPs
Three daily-delta loader SPs for sources that publish incremental updates:
All three: resolve LRNO via ABSD_SHIP_SEARCH, insert new defect records, skip duplicates (SOURCE + SOURCE_REF uniqueness check), write count of inserted rows to job log.
OFAC Sanctions Integration
OFAC (US Office of Foreign Assets Control) sanctions data is loaded and matched against ABSD company and vessel records.
| SP | Purpose |
|---|---|
spOFAC_LoadData | Loads raw OFAC SDN (Specially Designated Nationals) list into tblOFAC_SDN staging |
spOFAC_LoadNonData | Loads OFAC non-SDN consolidated list (broader sanctions) |
spOFAC_LoadOwcodeData | Maps matched OFAC entities to ABSD OWCODE records |
spOFAC_CleanTempTable | Truncates OFAC staging tables before new load |
spOFAC_OWSanctions_NEWLOAD_deltasRpt | Delta report: new sanctions vs prior load |
spOFAC_OWSanctions_NEWLOAD_ADDRESS_DeltasRpt | Address-level delta for sanctions |
spOFAC_OWSanctions_NEWLOAD_ALTID_DeltasRpt | Alt-ID delta (IMO numbers etc) for sanctions |
spPopulateBESSanctions_PROCESSED | Writes processed sanctions status to BES (beneficial entity screening) table |
spUpdateRiskScreeningData | Updates risk scores in tblRiskScreening from OFAC + UN data |
spUpdateRiskScores | Aggregates multiple risk sources into overall vessel risk score |
The sanctions status for company records is stored in SUPPLEMENTAL_ABSD_CBCY (see Section 09) via the country-of-registration flag. Vessel-level sanctions screening updates tblRiskScreening which feeds the Seaweb risk product.
UN Sanctions
Loads UN Security Council consolidated sanctions list into tblUNSanctions staging. Matches against ABSD company records by name (using CleanCompanyNameForMatch + phonetic matching) and IMO number. Matched records are flagged in tblRiskScreening. Run after each UN update (typically weekly).
Janes Data Load Pipeline
Janes Defence supplies naval vessel data (warships, auxiliaries) not covered by LR survey. Seven SPs load different Janes data types:
| SP | Data Type |
|---|---|
spJanesInsertShipData | Basic vessel data (LRNO, name, type, dimensions) |
spJanesInsertStatusData | Status codes (active/laid-up/reserve/decommissioned) |
spJanesInsertCountryData | Flag/country codes |
spJanesInsertShipClassData | Class/type grouping data |
spJanesInsertShipClassTaxonomyData | Class hierarchy (taxonomy tree) |
spJanesInsertMediaBlockData | Media/image block references |
spJanesDataReseed | Truncates all Janes staging tables before fresh load |
spLOAD_ABSD_* — Bulk Data Load SPs
| SP | Loads |
|---|---|
spLOAD_ABSD_AUX_ENGINES | Bulk loads auxiliary engine records from external source into ABSD_MAAU |
spLOAD_ABSD_PORTCONV | Port code conversion table refresh from standard port code source |
spLOAD_ABSD_SDDB | SDDB (Ship Dimensional Database) bulk load into dimension tables |
spLOAD_MSC_TEMP_CARGO_CODE | MSC cargo code mapping to ABSD cargo type codes |
spLOAD_MSC_TEMP_ENGINE_DETAILS | MSC engine specification load |
spLOAD_MSC_TEMP_LG | MSC load gauge/specification data |
spLOAD_MSC_TEMP_SHIPTYPE | MSC ship type mapping |
SBR Processing
SBR (Survey/Build Record) data comes from external survey bodies.
| SP | Purpose |
|---|---|
spSBRProcessCurrentAgainstLRF | Compares current SBR data against LRF (LR Fairplay) baseline; identifies discrepancies |
spSBRTIPProcessCurrentAgainstLRF | SBR data processed through the TIP validation pipeline |
spSBREmailHandlerError | Emails error alerts when SBR load fails or produces high discrepancy count |
spSBRProcessedAttachments | Lists SBR email attachments that have been processed |
spImportSBRIntoTIP | Imports validated SBR records into the TIP Classic pipeline for processing |
TIP/MIS SP Reference
The TIP/MIS pipeline (~100 SPs) is documented in full in Section 08. Quick reference of the key SPs by phase:
| Phase | Key SPs |
|---|---|
| Load & stage | spTIPPSCLoad, spTIPMRRegularImport, spTIPAISregularImport_OLD |
| LRNO derivation | spTIPDeriveLRNO |
| Validation | spTIPValidate, spTIPValidateCallsign, spTIPValidateDateTime, spTIPValidateDecimal, spTIPValidateInteger, spTIPValidateVarchar, spTIPAutoValidate* |
| LRF comparison | spTIPProcessCurrentAgainstLRF, spTIPProcessCurrentDateTimeAgainstLRF, spTIPProcessCurrentDecimalAgainstLRF, spTIPProcessCurrentIntegerAgainstLRF, spTIPProcessCurrentVarcharAgainstLRF |
| Action processing | spTIPProcessUpdate, spTIPMarkAsProcessed, spTIPAutoProcess* |
| FlexTemp pipeline | spTIPMISValidate, spTIPMISProcessCurrentAgainstLRF, spTIPMISManipulationRulesEngine, spTIPMISBusinessRule_Flextemp_Update |
| Expiry / cleanup | spTIPExpireData, spTIPCleanUpOldSupplies, spTIPMISExpireData |
spProduction* — APS Output Generation
The Production SPs generate the data feeds consumed by the APS (Annual Publication System) for Register Book and online output. Each SP runs a large SELECT across multiple ABSD_ tables, applies the APS field formatting rules, and writes to a production output staging table.
| SP | Output |
|---|---|
spProductionNarratives | Generates APS narrative text for vessels by calling fnAPSNarrative* family functions. Primary Register entry text. |
spProductionExtras | Generates supplementary data fields for Register (capacity tables, special features, certificates). Note: an _Old20April2026 version is kept as rollback. |
spProductionCasualties | Generates casualty section data from ABSD_CAGE1/CADI/CACO/CALA |
spProductionCasualtiesEvents | Generates casualty event detail data |
spProductionEngineBuilder | Generates engine builder data (ABSD_MAEM1 + ABSD_HIMO + builder OWNA join) |
Companion: spAPSRELBUILDERHISTORY — APS relationship builder history (generates the "formerly owned by" ownership history section). spPopulateAPSRelSurveyDates — populates APS survey date fields from ABSD_LRSC/LRSU.
NB Email Builder SPs
Generates email notifications for newbuild status changes sent to subscribers:
| SP | Purpose |
|---|---|
spNBEmailEngineDetail | Generates engine specification text block for NB email body |
spNBEMailBuilderAddress | Formats builder address for NB email |
spNBEMailBuilderComms | Formats builder communications details for NB email |
spNBEMailOwnerAddress | Formats owner address for NB email |
spNBEMailOwnerComms | Formats owner communications details for NB email |
spNBEMailownerComms | Variant — note lowercase 'o' (legacy naming) |
FSW (Fairplay Seaweb) NB page SPs: spFSWSalePageExName, spFSWSalePageLastSale, spFSWSalePageSameOperator — build the FP newbuild page sections for the online Register.
spEDM_BF_* — EDM Backfill
EDM (Entity Data Master) backfill SPs populate ABSD records from the EDM platform during the partial migration:
| SP | Backfills |
|---|---|
spEDM_BF_ANNOTATIONS | Copies tblChanges annotations from EDM entity annotations to ABSD annotation tables |
spEDM_BF_CBPI | Backfills ABSD_CBPI (P&I club codebook) from EDM club records |
spEDM_BF_HTML_BODY | Backfills HTML body text fields from EDM content management |
spEDM_BF_PANDI | Backfills ABSD_PANDI P&I insurance records from EDM insurance data |
spEDM_BF_PSC | Backfills PSC inspection records from EDM PSC store |
sp*RowSource* — UI Codebook Lookup SPs (80+)
RowSource SPs power the dropdown lists and lookup fields in the Captiva data-entry UI. Each SP returns a two-column result set: (Code, Description) ordered for display. They query the ABSD_CBUB1 codebook table filtered by FLDI (field discriminator) code, or in some cases query dedicated reference tables directly.
spD07_CODEValidRowSource → ABSD_FUCA2.D07_CODE field. spFlagDecodeRowSource → flag state dropdown. spB09_FOR_CLASSRowSource → foreign class society code lookup.| Category | SPs |
|---|---|
| Cargo type / stowage | spD01_INT_BASICRowSource, spD01_TYPAllRowSource, spD03_ALT_CODE_3RowSource, spD07_CODEValidRowSource, spD07_CODEValidRowSourceWithMainGroup, spD07_CODEValidRowSourceWithSubGroups, spD08_COMMODITYRowSource, spD08_StowageRowSource |
| Structural material | spD09_MATRowSource, spD09_POSRowSource, spD09_TYPRowSource, spD10_OTHER_TYPRowSource, spD16_MATRowSource, spD16_PSTNRowSource, spD16_TYPRowSource |
| Deck / fitting type | spD11_SMESRowSource, spD11_TYPERowSource, spD12_ALINRowSource, spD12_DSGNRowSource, spD12_LNNGRowSource, spD12_SHPRowSource, spD12_TYPRowSource |
| Loading gear / ramp | spD17_POSRowSource, spD19_LG_TYPRowSource, spD20_ATYPERowSource, spD23_RAMP_TYPERowSource, spE36_GEAR_TYPRowSource |
| Electrical / engine | spE45_GSRowSource, spE54_GTRowSource, spE63_PROP_TYPRowSource, spE87_FTYPRowSource, spE95_THST_STATRowSource, spE95_THST_TYPRowSource |
| Flag / country / port | spFlagDecodeRowSource, spFlagDecodeNoCodeRowSource, spCountryDecodeCurrentRowSource, spPortDecodeRowSource, spPortRowSource, spPortRowSourceCasualtySearch |
| Fuel / tank | spF08_CABGRADRowSource, spF09_TXTRowSource, spF11_CODERowSource, spF18_TYPERowSource, spTankRowSource, spTankCoatRowSource |
| Hull / structure | spG01_HULL_SECNRowSource, spC01_HUL_CONNRowSource, spC01_HUL_MATRowSource, spC01_HUL_SECNRowSource, spHullShapeRowSource, spHullTypeRowSource, spHEATMATERIALRowMaterial |
| Status / type codes | spStat5CodeRowSource, spStat5CodewithHullShape, spStat5CodewithoutHullShape, spStandardDesignRowSource, spSubTypeRowSource (and variants A–E, WithStatCode), spTONTYPRowSource |
| Class / survey | spB09_FC_STRowSource, spB09_FOR_CLASSRowSource, spCLASSDecodeRowSource, spLRCLASSINDRowSource, spINSTRowSource |
| Address / company | spABSD_OWAD1CountryRowSource, spABSD_OWAD1TownRowSource, spCountryDecodeCurrentRowSource, spStreetRowSource, spTownRowSource, spTownRowSourceButNotPostalStyle, spTownRowSourceButNotPostalStyleForBuilders, spSalutationRowSource |
| Casualty / breaker | spCasualtyBreakerRowSource, spD05_PRTYPRowSource, spD05_SCRPARowSource, spOE01_CARowSource |
| Other | spA02_STSRowSource, spCurrencyDecodeRowSource, spDCDecodeRowSource, spEMDecodeRowSource, spESDecodeRowSource, spMetaMainCategoryRowSource, spMetaSubCategoryRowSource, spPandICodeRowSource, spPOS_CODERowSource, spPositionRowSource, spPOSRowSource, spSBPOS_RowSource |
Codebook Helper SPs
| SP | Purpose |
|---|---|
spGetCompanyName | Returns company display name for a given OWCODE (from ABSD_OWNA) |
spGetCompanyNameAnno | Returns company name formatted for annotation display |
spGetCountryName | Returns country name for a 3-char ISO code (from ABSD_CBCY) |
spGetDate / spGetDates | Returns formatted current date / date range for use in batch SP headers |
spGetForeignClass | Returns foreign classification society name for ABSD_FOR_CLASS records |
spGetLRClass | Returns LR class notation text for ABSD_HILC records |
spGetEngineDetails | Returns formatted engine summary text for a vessel (for UI display) |
spGetCapacities | Returns formatted capacity summary (TEU, DWT, cargo type) for a vessel |
spGetTownName / spCreateTownName | Lookup and creation for port/town names in ABSD_CBUB1 |
Spot_* — SQL Server Diagnostics (60 SPs)
The Spot_* family (approximately 60 SPs) are SQL Server administration and diagnostic tools, not maritime business logic. They are installed in LRUpdate but are generic DBA tooling. Key categories:
| Category | SPs |
|---|---|
| Connection monitoring | Spot_Connections, Spot_ConnectionDetails, Spot_ConnectionList, Spot_IWOldestTransactions |
| Locking / blocking | Spot_Locks, Spot_LockStats, Spot_LatchesLocks, Spot_WaitsList |
| Database info | Spot_DatabaseInfo, Spot_FilesGroupsDisksList, Spot_GetAllDBList, Spot_GetDBProperties, Spot_GetDBStatus |
| Object inspection | Spot_IWObjectColumns, Spot_IWObjectDepends, Spot_IWObjectIndexes, Spot_IWObjectPermissions, Spot_ObjectsByDatabase |
| Buffer / memory | Spot_BufferCacheContents, Spot_BufferManager, Spot_GetMemoryDetails, Spot_GetMinPotentialAvailable, Spot_ProcCacheByType |
| Job monitoring | Spot_Jobs, Spot_JobDurations (via spJobDurations), Spot_LogMessage |
| Error log | Spot_CheckErrorlogSize, Spot_GetErrorlogFileInfo, Spot_ListErrorlogs |
| Replication | Spot_CheckIfReplicationInstalled, Spot_LogShippingInSync, Spot_LogShippingMonitorInfo, Spot_ReplicationReinit |
| Refresh / maintenance | Spot_RefreshDB_DBStatus, Spot_RefreshDB_FileChange, Spot_RefreshDB_IXChange, Spot_RefreshDB_MaintainFGInfo, Spot_Cleanup1 |
| Misc | Spot_Statistics, Spot_TableSize, Spot_TablesList, Spot_VersionInfo, Spot_GlobalVariables, Spot_ServerInfo (via Spot_GetServerInfo), Spot_SQL2K_IOByFile |
Fog_* — Performance Monitoring SPs
| SP | Monitors |
|---|---|
Fog_AMPerfInfo | AlwaysOn / availability group performance metrics |
Fog_BMPerfInfo | Buffer manager performance counters |
Fog_DBPerfInfo | Database-level performance counters (I/O, transactions/sec) |
Fog_Jobs | SQL Agent job status and recent run history |
Fog_MMPerfInfo | Memory manager performance counters |
DBA / Utility Miscellaneous
| SP | Purpose |
|---|---|
dba_Perf_FilestatGathering | Collects I/O filestat snapshot for trending analysis |
sp_leadblocker | Identifies the head-of-chain blocking process (kills it after confirmation) |
sp_lock2 | Enhanced sp_lock showing lock details with object names |
sp_TableStatsCounts | Returns row counts for all tables in the database |
TableCounts | Quick row-count summary for monitoring table growth |
TableList | Returns all tables with their creation date and schema |
SearchAllTables | Searches all varchar columns in all tables for a given string (slow — admin use only) |
spReIndexAllTables | Rebuilds all indexes in the database (scheduled weekly maintenance) |
spGrantPublicAllPermissions | Grants EXECUTE on all SPs and SELECT on all tables to the public role |
spJobFailureChecker | Checks for failed SQL Agent jobs in the last 24h and sends alert email |
spJobDurations | Returns recent job run times for SLA monitoring |
qs_spc_min_version | Returns minimum compatible version string for the QS SPC monitoring tool |
spsysGetTableDetails / spsysGetTableFieldCount | Schema introspection: returns table column details and field counts |
spFindTabs / spFindText | Searches SP/function bodies for tab characters or specific text strings |
spReportSpecialCharacters | Reports records containing non-ASCII or problematic special characters |
Clean_Characters | Cleans special characters from a specified table/column (admin utility) |
SeperateWords | String utility: splits a delimited string into a result set of words |
SGTEST | Seaweb/Global test SP — functional test entry point |
_DELETEITALL_ | Nuclear option: drops all tables/SPs/views (NEVER run in production — test environment only) |
spMailboxReaderSettings | Configures settings for the automated mailbox reader that processes incoming SBR/TIP emails |
spRetrieveEmailAddressfromAD | Looks up email address from Active Directory for a given Windows username |
spPinkMailSent | Logs that a "pink mail" (internal data alert) has been sent for a vessel |