Question

I am trying to insert some rows into a sqlite database where some of the fields have a semicolon in them. I know there is a way to change the delimiter from a semicolon to $$ in postgres with DELIMITER $$ , but is this possible with sqlite? Thanks!

Here is a snippet of my code (I'm not including all of it, mostly because the rest of it is inserts, and if we can get two to work, then we can get 300 to work):

DELIMITER $$


CREATE TABLE IF NOT EXISTS search ( 
  title VARCHAR(255) NOT NULL, 
  author TEXT,
  database_link VARCHAR(255)
) 


INSERT INTO search VALUES  
('Changes in soil microbial community structure following the abandonment of agricultural terraces in mountainous areas of Eastern Spain', 'Zornoza, R.; Guerrero, C.; Mataix-Solera, J.; Scow, K. M.; Arcenegui, V.; Mataix-Beneyto, J.', 'http://ucanr.edu/sites/superfund/files/176016.pdf'), 
('Near infrared spectroscopy for determination of various physical, chemical and biochemical properties in Mediterranean soils',   'Zornoza, R.; Guerrero, C.; Mataix-Solera, J.; Scow, K. M.; Arcenegui, V.; Mataix-Beneyto, J.', 'http://ucanr.edu/sites/superfund/files/176017.pdf') $$
Was it helpful?

Solution

Nevermind I figured it out. My problem was with the multiple inserts, not with semicolons. The following code works, and there's even a semi-colon inside!

CREATE TABLE IF NOT EXISTS search ( 
  title VARCHAR(255) PRIMARY KEY NOT NULL, 
  author TEXT, 
  database_link VARCHAR(255)
);

INSERT INTO search VALUES  
('Changes in soil microbial community structure following the abandonment of agricultural terraces in mountainous areas of Eastern Spain', 'Zornoza, R.; Guerrero, C. Mataix-Solera, J. Scow, K. M. Arcenegui, V. Mataix-Beneyto, J.', 'link1');
INSERT INTO search VALUES 
('Near infrared spectroscopy for determination of various physical, chemical and biochemical properties in Mediterranean soils', 'Zornoza, R. Guerrero, C. Mataix-Solera, J. Scow, K. M. Arcenegui, V. Mataix-Beneyto, J.', 'link2');
INSERT INTO search VALUES 
('Mathematical model of Chlorella minutissima UTEX2341 growth and lipid production under photoheterotrophic fermentation conditions', 'Yang, JinShui Rasa, Ehsan Tantayotai, Prapakorn Scow, Kate M. Yuan, HongLi Hristova, Krassimira R.', 'link3');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top