Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2009-09-30 21:09:34

Tjalve
Member
Registered: 2008-05-09
Posts: 83
Website

SQLite and INT starting with zero

I have a problem with SQLite 3.0 and wodering if anyone had the same problem before.

I can't seem to save INTs starting with 0 correctly.
ex. 080168 get saved as 80168, but if i just try 0 it get saved correctly as 0.

I made a new table to test this out. Onle field with an INT value, but get the same.

Using SQLite admin and SQLite Manager.

Offline

#2 2009-09-30 21:16:29

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 3,755
Website

Re: SQLite and INT starting with zero

I don't see the problem. What's so important about that leading zero? It saves the correct value, isn't that the important thing?

If you want to keep it, you probably have to use something like VARCHAR...


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#3 2009-09-30 21:36:06

FSX
Developer
From: NL
Registered: 2008-05-09
Posts: 803
Website

Re: SQLite and INT starting with zero

This is normal. The zero does not add any value to the number so why store it?

If you really want to have the 0 in front of the number then you should save it as a string (varchar), but that's kinda stupid.

Last edited by FSX (2009-09-30 21:40:36)

Offline

#4 2009-09-30 21:42:44

Tjalve
Member
Registered: 2008-05-09
Posts: 83
Website

Re: SQLite and INT starting with zero

08 is the year so it adds something, but ill just change it to VARCHAR. Ta

Offline

#5 2009-10-01 06:49:00

FSX
Developer
From: NL
Registered: 2008-05-09
Posts: 803
Website

Re: SQLite and INT starting with zero

I would use 2008. ^^

Offline

Board footer

Powered by FluxBB 1.4.8