Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SQLite3: INSERT INTO statement error – unrecognized token/no such column

I am trying to insert values in a table in Sqlite3, but unable to do so.
Table name: orphan_dbis_consolidated_report

PRAGMA table_info(orphan_dbis_consolidated_report);

Schema Output is

0|Date|TEXT|1||0
1|Host|TEXT|1||0
2|Usage|TEXT|0||0
3|Port|TEXT|1||0
4|Wf_Context_Id|TEXT|0||1
5|Automation_Name|TEXT|1||0

So The Statement i am using to insert values is:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

INSERT INTO orphan_dbis_consolidated_report (Date, Host, Usage, Port, Wf_Context_Id, Automation_Name) VALUES (‘2022-06-30’, ‘db167019.bwi101.service-now.com’, ‘Read_Replica’, ‘3400’, ‘8778405edb501d983050ac44d49619a5’, ‘Cid_CloneEngineContextCLN0535392’);

Now for above query i get Error: unrecognized token: "30’"

Note :

I have tried putting values in double quotes as well, in that case, i get error like column not found (it tries to assert given values as a column name and then says that column name does not exist)

Also I have tried to put column names in double quotes and values in single quotes, then i get error like: Error: table orphan_dbis_consolidated_report has no column named “Date”. Same case when I put column name in single quote.

Can anyone suggest what is wrong in this simple insert statement. Thanks

>Solution :

You are using the Unicode codepoints 0x2018 and 0x2019 as single quotes: ‘...’ (LEFT SINGLE QUOTATION MARK, RIGHT SINGLE QUOTATION MARK).

Use the ASCII single quote instead: '.

INSERT INTO orphan_dbis_consolidated_report
    (Date, Host, Usage, Port, Wf_Context_Id, Automation_Name)
    VALUES ('2022-06-30', 'db167019.bwi101.service-now.com', 'Read_Replica', '3400', '8778405edb501d983050ac44d49619a5', 'Cid_CloneEngineContextCLN0535392');
--          ~          ~  ~                               ~  ~            ~  ~    ~  ~                                ~  ~                                ~
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading