Definitions
Business Central uses Unicode to support multiple languages and special characters. NVarChar is the SQL-Server type for Unicode strings.
Terms:
string uuid (Universally Unique Identifier)
GUID (Globally Unique Identifier) - a Microsoft term.
|
AL Type |
SQL Server Type |
Notes / Behavior |
|---|---|---|
|
|
|
Always Unicode. Right-trimmed. Typically upper-cased automatically. |
|
|
|
Unicode. Preserves spaces. |
|
|
|
Unlimited text length. |
|
|
|
Stored as 16-byte GUID. |
|
|
|
32-bit integer. |
|
|
|
64-bit integer. |
|
|
|
Fixed precision decimal. |
|
|
|
Stored as 0 or 1. |
|
|
|
Date only; time portion = 00:00:00. |
|
|
|
Date part = 1753-01-01; time is used. |
|
|
|
Both date and time. |
|
|
|
Internally stored as milliseconds. |
|
|
|
Stores the zero-based index of the selected option. |
|
|
|
Stores the enum value’s integer ID. |
|
|
|
Used for media, streams, or large data (images, docs, etc.). |
|
|
|
Same as BLOB but managed by system tables. |
|
|
|
Same as Media, supports multiple files. |
|
|
|
Internal unique record identifier. |
|
|
Matches underlying key field |
Foreign key constraint may not exist physically but can be indexed. |
Additional notes
-
All string types (
Code,Text) usenvarchar— nevervarchar.
→ This ensures Unicode compatibility across all languages. -
Business Central uses binary collations (e.g.,
Latin1_General_100_BIN2) for deterministic sorting and comparison, especially forCodefields. -
CodeandTextdiffer mainly in trimming and case handling:-
Code→ trimmed, often upper-cased -
Text→ preserves spaces and case
-
-
Fields with spaces or punctuation in their AL name (e.g.,
"Customer No.") appear in SQL as[Customer No_].
Business Central Definition (the built in AL programming language)
table 50100 "Example Table"
{
fields
{
field(1; "ID"; Guid) { }
field(2; "Code"; Code[20]) { }
field(3; "Description"; Text[100]) { }
field(4; "Amount"; Decimal) { }
field(5; "Is Active"; Boolean) { }
}
}
Note: Code fields automatically convert to uppercase in many contexts (depends on locale and BC version)
Corresponding SQL server results
CREATE TABLE [dbo].[Example Table]
(
[timestamp] rowversion NOT NULL,
[ID] uniqueidentifier NOT NULL,
[Code] nvarchar(20) COLLATE Latin1_General_100_BIN2 NOT NULL,
[Description] nvarchar(100) COLLATE Latin1_General_100_BIN2,
[Amount] decimal(38,20),
[Is Active] tinyint NOT NULL,
[SystemCreatedAt] datetime2(0) NOT NULL,
[SystemModifiedAt] datetime2(0) NOT NULL
)
Why nvarchar, not varchar?
Because Business Central supports Unicode across all languages and locales — Icelandic, Arabic, Japanese, etc.
That means Code and Text fields are always stored as Unicode strings (nvarchar), so you can store characters like “Þ”, “Á”, “ð”, “é”, etc. safely.
|
|
|
|
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Collation and Sorting Behavior in Business Central
|
AL Type |
SQL Type |
Default Collation |
Case Sensitivity |
Space Sensitivity |
Sort Order |
Comments |
|---|---|---|---|---|---|---|
|
|
|
|
✅ Case-sensitive |
✅ Space-sensitive |
Binary |
Fast, deterministic, strict |
|
|
|
|
✅ Case-sensitive |
✅ Space-sensitive |
Binary |
Same as Code |
|
(Older NAV, pre-BC15) |
|
e.g. |
❌ Case-insensitive |
❌ Space-insensitive |
Linguistic |
Slower, locale-dependent |
What "Binary Collation" means
Business Central (from BC 15 / AL language onwards) uses binary collations in SQL Server:
Latin1_General_100_BIN2
That means:
-
Strings are compared byte-by-byte, not linguistically.
-
"A"≠"a"(case-sensitive). -
"ABC "≠"ABC"(space-sensitive). -
Sorting follows binary order, not dictionary order (e.g., “Z” < “a”).
This ensures deterministic and very fast comparisons — important for indexing, keys, and replication