# Table object
Tables are the core objects used to store data in Business Central. No matter how data is registered in the product&mdash;from a web service to the phone app&mdash;the results of that transaction are recorded in a table.
## Table syntax
The structure of a table has four sections:
 The first block contains metadata for the overall table, such as the table type.
 The fields section describes the data elements that make up the table, such as their name or the type of data they can store.
 The keys section contains the definitions of the keys that the table needs to support.
 The final section details the triggers and code that can run on the table.
The order in which the sections appear matters. The following example illustrates the ordering:
```al
table ObjectId TableName
{
    // Specify table properties, for example
    Caption = 'Sample table';
    DataPerCompany = true;

    // Define the table schema
    fields {}

    // Define keys section (optional)
    keys {}

    // Add AL code here (optional)
}
```
## Table object limits
The table object has limitations that are mostly dictated by SQL Server, such as the maximum record size, number of fields, and the number of keys.
See devenv-object-specifications-limitations.
## Table extensibility limitations
> IMPORTANT
> Only tables with the properties/devenv-extensible-property set to true can be extended.
> NOTE
> Extension objects can have a name with a maximum length of 30 characters.
> IMPORTANT
> System and virtual tables can't be extended. System tables are created in the ID range of 2.000.000.000 and higher. See devenv-object-ranges.
## System fields
The Business Central platform automatically adds several system fields to tables. See devenv-table-system-fields.
## Defining default values for fields
It's common to have field values set to a default value. To set a default, you set the InitValue property on the field.
See properties/devenv-initvalue-property.
## Defining validation rules for fields
If you want to run business logic to validate the value of a field, you can define the OnValidate trigger on the field.
See triggers-auto/field/devenv-onvalidate-field-trigger.
## Snippet support
Typing the shortcut ttable creates the basic layout for a table object when using the AL Language extension for Microsoft Dynamics 365 Business Central in Visual Studio Code.
> TIP
> Use Ctrl+Space to trigger IntelliSense and get assistance on code completion, parameter info, quick info, and member lists. For more information about snippets, see Syntax and snippets<devenv-syntax>.
## Add tooltips on table fields
Starting in Business Central 2024 release wave 1, you can define tooltips on table fields. When a tooltip is defined on a table field, any page that uses the field automatically inherits the tooltip.
See Add tooltips to table and page fields<devenv-adding-tooltips>.
## Enable full-text search on table fields
> APPLIES TO: Business Central 2024 release wave 2 (v25) and later.
You can specify whether table fields are optimized for text search by setting the OptimizeForTextSearch property to true.
See Enable text search on table fields<devenv-table-field-text-search>.
## Table example
This table stores address information and it has five fields; Address, Locality, `Town/City`, County, and IsValidated.
```al
table 50104 Address
{
    Caption = 'Sample table';
    DataPerCompany = true;

    fields
    {
        field(1; Address; Text[50])
        {
            Caption = 'Address retrieved by Service';
            // in 2024 release wave 2, you can define that table fields are included in optimized text search
            OptimizeForTextSearch = true;
        }
        field(2; Locality; Text[30])
        {
            Caption = 'Locality retrieved by Service';
            Description = 'Locality feature likely to change in vNext'; // Internal note (not shown in the client)
            OptimizeForTextSearch = true;
        }
        field(3; "Town/City"; Text[30])
        {
            Caption = 'Town/City retrieved by Service';
            // in 2024 release wave 1, you can define tooltips on the table field level
            ToolTip = 'Town/City retrieved by Service';
            OptimizeForTextSearch = true;
        }
        field(4; County; Text[30])
        {
            Caption = 'County retrieved by Service';
            OptimizeForTextSearch = true;

            // this is how you define field validation on the table level
            trigger OnValidate()
            begin
                ValidateCounty(County);
            end;

        }
        field(5; IsValidated; Boolean)
        {
            Caption = 'Address validated yet?';
            InitValue = false; // this is how you define default values
        }
    }

    keys
    {
        key(PrimaryKey; Address)
        {
            Clustered = true;
        }
    }
}
```
## Migrating fields from Integer to BigInteger
Starting with Business Central 2026 release wave 2 (runtime 18.0), you can change existing table fields from Integer to BigInteger during upgrades. This gradual migration enables you to expand the capacity of fields that might overflow as data volumes grow, without requiring a full schema rebuild.
Key behaviors:
 Field type upgrade: Changing a field from Integer to BigInteger is allowed when targeting runtime 18.0 or later.
 Property context warnings: When a BigInteger field is referenced in property contexts (TableRelation, CalcFormula WHERE clauses), the compiler emits warnings for narrowing conversions (BigInteger -> Integer) to alert about potential overflow at runtime.
 CalcFormula support: LOOKUP, MAX, and MIN operations allow Integer ↔ BigInteger conversions with appropriate warnings for narrowing conversions.
 AppSourceCop rule AS0141: Warns about the potential consequences for dependent extensions that reference a field whose type was changed from Integer to BigInteger.
```al
table 50100 "My Table"
{
    fields
    {
        // Changed from Integer to BigInteger in the new version
        field(1; "Entry No."; BigInteger) { }
        field(2; Description; Text[100]) { }
    }
}
```
> NOTE
> Narrowing conversions (BigInteger to Integer, Option, or Enum) in WHERE clauses emit compiler warnings. Review any dependent extensions that reference the upgraded field to ensure they handle the wider value range.
## Related information
devenv-tables-overview
Table extension object<devenv-table-ext-object>
Adding tooltips to table and page fields<devenv-adding-tooltips>
InitValue Property (defining default values for fields)<properties/devenv-initvalue-property>
triggers-auto/field/devenv-onvalidate-field-trigger
Enable text search on table fields<devenv-table-field-text-search>
devenv-table-keys
Table, table fields, and table extension properties<properties/devenv-table-property-overview>
devenv-object-specifications-limitations
AL development environment<devenv-reference-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-table-object, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-table-object/
