
10: Affixes
Another way to make a datetime is by using the d prefix. Affixes look similar to casts but are instructions to parse input as a certain type, rather than to convert into another type. Thanks to this, the queries below won't even run because the parser can already see that the last one won't work.
"There was a problem with the database: Parse error: Invalid datetime,
expected digit character found `E`
--> [8:3]
|
8 | d'EIGHTEEN FIFTY NINE, NOVEMBER TWENTY SIX';
| ^
"Another example where you would want to avoid a cast is when using the decimal type, a numeric type used for greater precision or extra large numbers. In all programming languages, a float with too many digits after the decimal point will become imprecise.
1000.0000000000001f1000fBut if you use a cast on such a number, the database will first create an imprecise float and then cast it into a decimal. So you don't want to use a cast either.
1000decUsing the dec suffix solves the problem by telling the database to treat the input as a decimal instead of a float.
1000.00000000000001decTHE PLATFORM
Everything an application and its agents know. Five surfaces, one engine.
Database
Document, graph, vector, time-series and relational in one engine.

Agent Memory
What an agent learns, with its source and its time, in the same engine.

Cloud
Managed clusters in the regions you choose, scaled on demand.

Studio
Query, explore and design the schema from the browser.

MCP
Every model that speaks MCP reaches the database and the memory directly.

IN PRODUCTION
Trusted at scale. Samsung, Nvidia, Verizon, Tencent, and Walmart run on SurrealDB.
14,000+
Developers building on SurrealDB Cloud
4M+
Developers building on SurrealDB worldwide
FROM THE TEAMS
SurrealDB gives us a foundation where we can unify semantic search, knowledge graphs, and AI-driven decision making without stitching together multiple systems. Collapsing responsibility into SurrealDB has become our default engineering posture.
VP of Engineering, Later