Calculated field
RAWSQL_DATETIME("CAST(%1 AS TIMESTAMP)", '2026-10-14 09:30:00')
Sample data
| label | quantity | amount | flag |
|---|---|---|---|
| cedar cedar | 65 | 12.8 | True |
| ORCHID-west | 66 | -7.6 | False |
| maple-east | 67 | 0 | null |
| willow north | 68 | 25.3 | True |
| birch-birch | 69 | 4.9 | False |
| pine/south | 70 | -1.2 | null |
| ash | 71 | 9 | True |
| null | null | null | null |
The same calculation as SQL
SELECT TIMESTAMP '2026-10-14 09:30:00' AS result FROM input
Runs the example above.
SELECT TIMESTAMP '2026-10-14 09:30:00' AS result FROM input
Written for this dialect; not run here.
SELECT DATETIME '2026-10-14 09:30:00' AS result FROM input
Written for this dialect; not run here.
Result
| result |
|---|
| 2026-10-14 09:30:00 |
| 2026-10-14 09:30:00 |
| 2026-10-14 09:30:00 |
| 2026-10-14 09:30:00 |
| 2026-10-14 09:30:00 |
| 2026-10-14 09:30:00 |
| 2026-10-14 09:30:00 |
| 2026-10-14 09:30:00 |
Same rows from the calculation and from the SQL in DuckDB.
Where a naive translation goes wrong
- RAWSQL embeds source-dialect SQL; replace the template for the target database.
Naive SQL
SELECT TIMESTAMP '2026-10-14 00:00:00' AS result FROM input
result 2026-10-14 00:00:00 2026-10-14 00:00:00 2026-10-14 00:00:00 2026-10-14 00:00:00 2026-10-14 00:00:00 2026-10-14 00:00:00 2026-10-14 00:00:00 2026-10-14 00:00:00 Matches the calculation
SELECT TIMESTAMP '2026-10-14 09:30:00' AS result FROM input
result 2026-10-14 09:30:00 2026-10-14 09:30:00 2026-10-14 09:30:00 2026-10-14 09:30:00 2026-10-14 09:30:00 2026-10-14 09:30:00 2026-10-14 09:30:00 2026-10-14 09:30:00
Signature
RAWSQL_DATETIME(constant_sql, [argument, ...])