All tables
tables · table

location

The location table serves as a master directory for physical and logical sites within the enterprise. It stores detailed geographic information (address, city, state), contact details (email, phone), and organizational metadata (Department, ChildLocation flag).

Row count
20
Last entry
Source
tables

Columns

14
ColumnTypeNullableMeaning
indexintegerNoInternal primary key/row index
compcodestringNoCompany unique identifier
locationstringNoThe primary name/ID of the location
locaddressstringYesPrimary street address
loccodestringYesInternal alphanumeric code for the location
DepartmentstringYesAssociated organizational department
locaddress2stringYesSecondary address line
locaddress3stringYesTertiary address line
locPINstringYesPostal/Zip code
citystringYesCity name
statecodestringYesState/Province code
ChildLocationstringYesFlag indicating if this is a sub-location
emailstringYesContact email for the site
phonecostringYesContact phone number for the site

Full documentation

### 1. Overview
 The `location` table serves as a master directory for physical and logical sites within the enterprise. It stores detailed geographic information (address, city, state), contact details (email, phone), and organizational metadata (Department, ChildLocation flag). 
 
 This table is critical for multi-site operations, as it is referenced by nearly every major module—including Sales (`invhdr`), Purchasing (`cpohdr`), Production (`jobhdr`), and Human Resources (`empmas`)—to specify where goods are stored, where production occurs, or where employees are stationed.
 
 ### 2. Column Dictionary
 
 | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage |
 | :--- | :--- | :--- | :--- | :--- | :--- |
 | **index** | integer | No | Internal primary key/row index | | Primary Key |
 | **compcode** | string | No | Company unique identifier | e.g., "DAS" | FK to `dbo.Company` |
 | **location** | string | No | The primary name/ID of the location | e.g., "1st floor", "BOP" | Main Join Key |
 | **locaddress** | string | Yes | Primary street address | | Reporting |
 | **loccode** | string | Yes | Internal alphanumeric code for the location | | Join Key (Likely) |
 | **Department** | string | Yes | Associated organizational department | | Filtering |
 | **locaddress2** | string | Yes | Secondary address line | | Reporting |
 | **locaddress3** | string | Yes | Tertiary address line | | Reporting |
 | **locPIN** | string | Yes | Postal/Zip code | | Logistics |
 | **city** | string | Yes | City name | | Filtering/Logistics |
 | **statecode** | string | Yes | State/Province code | | FK to `dbo.Statemas` |
 | **ChildLocation** | string | Yes | Flag indicating if this is a sub-location | "Y", "N" | Hierarchy |
 | **email** | string | Yes | Contact email for the site | | Notifications |
 | **phoneco** | string | Yes | Contact phone number for the site | | Reporting |
 
 ### 3. Relationships & Join Map
 
 #### Logical Joins (Primary)
 * **Transactional Headers:** Joins to `dbo.invhdr`, `dbo.cpohdr`, `dbo.jobhdr`, `dbo.fghdr`, and `dbo.rmincoming` via `(location, compcode)` to attribute transactions to a specific site.
 * **Production & Inventory:** Joins to `dbo.itemmas` and `dbo.job` via `(location, compcode)` to define the default storage or processing site for specific items.
 * **Physical Tracking:** Joins to `dbo.PhyLocation` via `(location, CompCode)` for granular bin/shelf tracking within a site.
 
 #### Strict Join Map (SCHEMA_MAP Verified)
 | Target Table | Join Column | Join Type | Context |
 | :--- | :--- | :--- | :--- |
 | `dbo.Statemas` | `statecode` | Many-to-One | Geographic lookup for state names. |
 | `dbo.invhdr` | `location`, `compcode` | One-to-Many | Identifying the dispatch/storage location of an invoice. |
 | `dbo.cpohdr` | `location`, `compcode` | One-to-Many | Identifying the delivery location for Purchase Orders. |
 | `dbo.jobhdr` | `location`, `compcode` | One-to-Many | Identifying the site responsible for a production job. |
 | `dbo.empmas` | `location`, `compcode` | One-to-Many | Linking employees to their assigned work location. |
 | `dbo.machine` | `location`, `compcode` | One-to-Many | Identifying the physical location of plant machinery. |
 | `dbo.PhyLocation` | `location`, `compcode` | One-to-Many | Mapping logical locations to physical warehouse slots. |