1

I cannot export my database to a sql file with adding quote to string number. I store code postal number as CHAR[5] but it exports without 'quote'.

eg: What I want my quoting string number '01234' like:

CREATE TABLE codepostal ( code CHAR( 5 ) PRIMARY KEY NOT NULL UNIQUE, name VARCHAR( 70 ) NOT NULL );
INSERT INTO [codepostal] ([code], [name]) VALUES ('01234', 'My_city');

But not 01234 (no quoting):

CREATE TABLE codepostal ( code CHAR( 5 ) PRIMARY KEY NOT NULL UNIQUE, name VARCHAR( 70 ) NOT NULL );
INSERT INTO [codepostal] ([code], [name]) VALUES (01234, 'My_city');

I want to export my db to a sql file then read it to re-create my db somewhere. But since I store code postal "01234" like CHAR[5] and it export without quoting, when I re-create my db > I losts my "0" because it read "01234" but only insert "1234" because my "01234" was no-quoting.

My SQLiteStudio was v2.1.5 and I stored as VARCHAR and TEXT but still no quoting.

Any suggestion can help, thanks. ^_^

Anh-Tuan Mai
  • 1,129
  • 19
  • 36
  • How exactly are you trying to export? – CL. Sep 02 '15 at 16:00
  • SQLite doesn't enforce data types. You might physically need to store the postal code as a string, including the format characters. Try storing as VARCHAR or TEXT? – Calvinthesneak Sep 02 '15 at 16:06
  • I update my question. I want to export my db to a sql file then read it to re-create my db somewhere. But since I store code postal "01234" like CHAR[5] and it export without quoting, when I re-create my db > I losts my "0" because it read "01234" but only insert "1234" because my "01234" was no-quoting. Thanks. – Anh-Tuan Mai Sep 03 '15 at 07:45

1 Answers1

0

SQLiteStudio 2.x.x is obsolete. Use the recent one (at the moment it's 3.0.6, available at its homepage). It will deal with your export correctly.

Googie
  • 5,742
  • 2
  • 19
  • 31