Add a primary key column when make query is executed

accessfever

Registered User.
Local time
Today, 10:07
Joined
Feb 7, 2010
Messages
101
I want to add a new primary key column (such as 1,2,3,4,5 and so on) when a make query is executed.

Is it a way to do that?
 
For example, I have a make query to create a new table with 3 columns like below:

col1 col2 col3
USA red skirt
JAP red pant
CHF blue sweater

But I want a new table like this to include a primary key column ( It is similar to have a primary key column when import a table) :
col1 col2 col3 col4
1 USA red skirt
2 JAP red pant
3 CHF blue sweater
 
You can either:

1. Create the table and add four fields
2. The first field will be the PK and its data type will be AUTONUMBER
3. Run the query and copy the records from the query and paste it into the new table

OR

1. Perform steps 1 and 2 above
2. Use an INSERT query like the one in example 2 in the link below:

http://www.techonthenet.com/sql/insert.php
 
I changed the 1st option's step 3 to be an append query and it works like what I need. Thanks!
 
You're becoming a champ at this;)

Glad that's sorted.
 

Users who are viewing this thread

Back
Top Bottom