{"title":"Table object","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-table-object/","by":"JOP-AL","license":"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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-table-object","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"This article describes the structure, object limits, and extensibility of the table object in AL for Business Central.","date":"2026-06-12","meta":{"topic":"how-to"},"outline":[{"level":2,"title":"Table syntax","slug":"table-syntax","at":221,"chars":803},{"level":2,"title":"Table object limits","slug":"table-object-limits","at":1024,"chars":217},{"level":2,"title":"Table extensibility limitations","slug":"table-extensibility-limitations","at":1241,"chars":376},{"level":2,"title":"System fields","slug":"system-fields","at":1617,"chars":131},{"level":2,"title":"Defining default values for fields","slug":"defining-default-values-for-fields","at":1748,"chars":200},{"level":2,"title":"Defining validation rules for fields","slug":"defining-validation-rules-for-fields","at":1948,"chars":217},{"level":2,"title":"Snippet support","slug":"snippet-support","at":2165,"chars":403},{"level":2,"title":"Add tooltips on table fields","slug":"add-tooltips-on-table-fields","at":2568,"chars":299},{"level":2,"title":"Enable full-text search on table fields","slug":"enable-full-text-search-on-table-fields","at":2867,"chars":305},{"level":2,"title":"Table example","slug":"table-example","at":3172,"chars":1702},{"level":2,"title":"Migrating fields from Integer to BigInteger","slug":"migrating-fields-from-integer-to-biginteger","at":4874,"chars":1481},{"level":2,"title":"Related information","slug":"related-information","at":6355,"chars":579}],"text":"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.\n## Table syntax\nThe structure of a table has four sections:\n The first block contains metadata for the overall table, such as the table type.\n The fields section describes the data elements that make up the table, such as their name or the type of data they can store.\n The keys section contains the definitions of the keys that the table needs to support.\n The final section details the triggers and code that can run on the table.\nThe order in which the sections appear matters. The following example illustrates the ordering:\n```al\ntable ObjectId TableName\n{\n    // Specify table properties, for example\n    Caption = 'Sample table';\n    DataPerCompany = true;\n\n    // Define the table schema\n    fields {}\n\n    // Define keys section (optional)\n    keys {}\n\n    // Add AL code here (optional)\n}\n```\n## Table object limits\nThe 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.\nSee devenv-object-specifications-limitations.\n## Table extensibility limitations\n> IMPORTANT\n> Only tables with the properties/devenv-extensible-property set to true can be extended.\n> NOTE\n> Extension objects can have a name with a maximum length of 30 characters.\n> IMPORTANT\n> 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.\n## System fields\nThe Business Central platform automatically adds several system fields to tables. See devenv-table-system-fields.\n## Defining default values for fields\nIt's common to have field values set to a default value. To set a default, you set the InitValue property on the field.\nSee properties/devenv-initvalue-property.\n## Defining validation rules for fields\nIf you want to run business logic to validate the value of a field, you can define the OnValidate trigger on the field.\nSee triggers-auto/field/devenv-onvalidate-field-trigger.\n## Snippet support\nTyping 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.\n> TIP\n> 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>.\n## Add tooltips on table fields\nStarting 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.\nSee Add tooltips to table and page fields<devenv-adding-tooltips>.\n## Enable full-text search on table fields\n> APPLIES TO: Business Central 2024 release wave 2 (v25) and later.\nYou can specify whether table fields are optimized for text search by setting the OptimizeForTextSearch property to true.\nSee Enable text search on table fields<devenv-table-field-text-search>.\n## Table example\nThis table stores address information and it has five fields; Address, Locality, `Town/City`, County, and IsValidated.\n```al\ntable 50104 Address\n{\n    Caption = 'Sample table';\n    DataPerCompany = true;\n\n    fields\n    {\n        field(1; Address; Text[50])\n        {\n            Caption = 'Address retrieved by Service';\n            // in 2024 release wave 2, you can define that table fields are included in optimized text search\n            OptimizeForTextSearch = true;\n        }\n        field(2; Locality; Text[30])\n        {\n            Caption = 'Locality retrieved by Service';\n            Description = 'Locality feature likely to change in vNext'; // Internal note (not shown in the client)\n            OptimizeForTextSearch = true;\n        }\n        field(3; \"Town/City\"; Text[30])\n        {\n            Caption = 'Town/City retrieved by Service';\n            // in 2024 release wave 1, you can define tooltips on the table field level\n            ToolTip = 'Town/City retrieved by Service';\n            OptimizeForTextSearch = true;\n        }\n        field(4; County; Text[30])\n        {\n            Caption = 'County retrieved by Service';\n            OptimizeForTextSearch = true;\n\n            // this is how you define field validation on the table level\n            trigger OnValidate()\n            begin\n                ValidateCounty(County);\n            end;\n\n        }\n        field(5; IsValidated; Boolean)\n        {\n            Caption = 'Address validated yet?';\n            InitValue = false; // this is how you define default values\n        }\n    }\n\n    keys\n    {\n        key(PrimaryKey; Address)\n        {\n            Clustered = true;\n        }\n    }\n}\n```\n## Migrating fields from Integer to BigInteger\nStarting 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.\nKey behaviors:\n Field type upgrade: Changing a field from Integer to BigInteger is allowed when targeting runtime 18.0 or later.\n 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.\n CalcFormula support: LOOKUP, MAX, and MIN operations allow Integer ↔ BigInteger conversions with appropriate warnings for narrowing conversions.\n AppSourceCop rule AS0141: Warns about the potential consequences for dependent extensions that reference a field whose type was changed from Integer to BigInteger.\n```al\ntable 50100 \"My Table\"\n{\n    fields\n    {\n        // Changed from Integer to BigInteger in the new version\n        field(1; \"Entry No.\"; BigInteger) { }\n        field(2; Description; Text[100]) { }\n    }\n}\n```\n> NOTE\n> 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.\n## Related information\ndevenv-tables-overview\nTable extension object<devenv-table-ext-object>\nAdding tooltips to table and page fields<devenv-adding-tooltips>\nInitValue Property (defining default values for fields)<properties/devenv-initvalue-property>\ntriggers-auto/field/devenv-onvalidate-field-trigger\nEnable text search on table fields<devenv-table-field-text-search>\ndevenv-table-keys\nTable, table fields, and table extension properties<properties/devenv-table-property-overview>\ndevenv-object-specifications-limitations\nAL development environment<devenv-reference-overview>"}