Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6693297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:58:00+00:00 2026-05-26T05:58:00+00:00

I have table with INTEGER PRIMARY KEY and I cannot insert value greater then

  • 0

I have table with INTEGER PRIMARY KEY and I cannot insert value greater then 2147483647 as a key. Is it possible to increase this value somehow?

UPDATE:
Ok, I have php script:

<?php

$sqlite_db = new SQLite3('test');
$sqlite_db->exec('CREATE TABLE test (n UNSIGNED INTEGER)');

$ns = array(1111111111,2222222222,3333333333,4444444444,5555555555,6666666666,7777777777);

foreach ($ns as $n)
{
    $statement = $sqlite_db->prepare('INSERT INTO test (n) VALUES (:n)');
    $statement->bindValue(':n', $n, SQLITE3_INTEGER);
    $statement->execute();
}

$sqlite_db->close();
?>

and what I get in test database is that:

root@localhost:~# sqlite3 test 
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from test;
1111111111
-2072745074
-961633963
149477148
1260588259
-1923267926
-812156815

So my question is: how to insert large values into sqlite database from php?

UPDATE2:

I have changed foreach body to:

$sqlite_db->exec("INSERT INTO test (n) VALUES ({$n})");

and it works ok now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:58:00+00:00Added an answer on May 26, 2026 at 5:58 am

    I’ve never seen that behavior with SQLite3. Edit your question, and paste the output of .schema your-table-name. Also, make sure the problem isn’t in your application code.

    Declaring a column as integer in SQLite works differently than declaring a column as integer in a true SQL dbms. In SQLite3, any column declared INTEGER PRIMARY KEY ought to accept any 64-bit, signed integer. 64-bit integers max go to 1.84467441 × 1019. (Your column should accept negative integers, too.)

    INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8
    bytes depending on the magnitude of the value.

    sqlite> create table t ( n integer primary key, s varchar(35));
    sqlite> insert into t (s) values ('a');
    sqlite> insert into t (s) values ('a');
    sqlite> insert into t (s) values ('a');
    sqlite> select * from t;
    1|a
    2|a
    3|a
    

    So, it automatically increments . . .

    sqlite> insert into t values (2147483647, 'a');
    sqlite> select * from t;
    1|a
    2|a
    3|a
    2147483647|a
    

    And it accepts the maximum value of a 32-bit signed integer.

    sqlite> insert into t (s) values ('a');
    sqlite> insert into t (s) values ('a');
    sqlite> insert into t (s) values ('a');
    sqlite> select * from t;
    1|a
    2|a
    3|a
    2147483647|a
    2147483648|a
    2147483649|a
    2147483650|a
    

    And it increments past the maximum value of a 32-bit signed integer.

    sqlite> insert into t values (8589934592, 'a');
    sqlite> select * from t;
    1|a
    2|a
    3|a
    2147483647|a
    2147483648|a
    2147483649|a
    2147483650|a
    8589934592|a
    

    It accepts values in the range of 233.

    sqlite> insert into t (s) values ('a');
    sqlite> select * from t;
    1|a
    2|a
    3|a
    2147483647|a
    2147483648|a
    2147483649|a
    2147483650|a
    8589934592|a
    8589934593|a
    

    And it continues to automatically increment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table similar to this: CREATE TABLE example ( id integer primary
I have a table that's created like this: CREATE TABLE bin_test (id INTEGER PRIMARY
Let's say you have a table with a integer primary key named 'table_id' Is
I have a table in SQLite: CREATE TABLE EventType ( [EventTypeID] INTEGER PRIMARY KEY,
i have 2 tables CREATE TABLE if not exists tag_name( + tagid INTEGER PRIMARY
I have sqlite3 database with example structure and data: CREATE TABLE person(id INTEGER PRIMARY
Assume the following in MySQL: CREATE TABLE users ( id integer auto_increment primary key,
I have a SQL Server 2005 table like this: create table Taxonomy( CategoryId integer
I have a SQLite table that looks like this: CREATE TABLE Cards (id INTEGER
I use this for autoincreamenting one column , create table info (ID INTEGER PRIMARY

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.