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 4002414
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:01:34+00:00 2026-05-20T08:01:34+00:00

I have a table where I need to have a _id column which is

  • 0

I have a table where I need to have a _id column which is incremented. However I cannot use autoincrement due to the table having 3 primary keys. This is in SQLite, btw. The table is already populated with data and therefore I cannot just recreate the table.

Is there a way to insert values from 1 to 148 in the _id column?

We’ve already tried something like this:

UPDATE table1
SET _id = (SELECT _id FROM table2)

table2 is a temp table which contains the values from 1 to 148. However this just updates all _id values to ‘1’..

Any suggestions on how to solve this?

  • 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-20T08:01:34+00:00Added an answer on May 20, 2026 at 8:01 am

    Not certain I understand. But let me try.

    • table1 has a primary key consisting
      of three columns.
    • One of the columns is named “_id”.
    • The column “_id” is an integer, but
      not an automatically incremented
      integer.
    • You want to insert values 1 to 148
      into table1._id.

    In SQLite, if either of the other two columns in the primary key are defined as “NOT NULL”, then you can’t do that. You have to insert values for all the “NOT NULL” components of the primary key at the same time. But if they’re nullable, you can insert values into table1._id. Just

    insert into table1 (_id)
    select _id from table2;
    

    This will insert new rows into table1 with null values for all columns except _id.

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

Sidebar

Related Questions

I need a table which has two columns: First column have an ID Second
I have a table on SQL2000 with a numeric column and I need the
I have a table of time-series data of which I need to find all
I have a table with a credit and debit column. I need to get
I have a table with a column that needs the data type upgrading. However
I have a table with columns ID, DateStamp and the ID need not be
I have a table of about a million rows and I need to update
I have a table that contains maybe 10k to 100k rows and I need
I have a table of events, I need to find all tail events of
I have a table that got into the db_owner schema, and I need it

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.