I did a mistake and declared a SQLite table column in CREATE TABLE
DDL statement as STRING
. Inserting '00123'
into that column results as numeric value 123
being written (so leading zeroes are lost). I now know I should have used TEXT
.
Is there any way, using FireDAC, to somehow force TEXT
affinity for that column without dropping and recreating the table? Or, in other words, force leading zeroes to be written in the STRING
column type?
I've tried INSERT INTO table_name (string_column) VALUES (CAST('00123' AS TEXT))
with no luck.
If drop/create table is the only way forward, is there a way to know for a table whether a column was created as STRING
(so, get its affinity)?
-žarko
select sql from sqlite_master where name = 'table_name'
– Branko Jan 13 at 18:56BLOB
affinity using BLOB literal:INSERT INTO table_name (string_column) VALUES (x'3030313233')
. – Peter Wolf Jan 14 at 10:07