Adding Auto Number Field To Table Via Data Definition Query

The Brown Growler

Registered User.
Local time
Today, 21:57
Joined
May 24, 2008
Messages
85
Hi,

Would anyone please be able to advise me if it is possible to add and populate an auto number field to an existing table using a data definition query?

If it is possible any help with the SQL would be most appreciated.



Rgds
Growlos
 
I tried to create a data definition query to add and populate an auto number field using the SQL pasted below in an SQL query, however, I keep getting a syntax error with the code?


Alter TABLE T_Sales ADD COLUMN SalesID NUMBER
Alter TABLE T_Sales Alter COLUMN SalesID (1000,1)


Even after splitting the 2 lines into 2 separate queries I am getting a syntax error with the "Alter COLUMN" line, ie, the 2nd line or query?

I think that I might be looking at this from the wrong perspective, in practice, what I wish to do is to add a new column to an existing table which contains records and then incrementally populate the newly added column with numbers. There will be no more records added to the table after the new column is added so perhaps an auto number field is not required, just a new column populated with incremental numbers?


Rgds
Growlos
 
Last edited:

Users who are viewing this thread

Back
Top Bottom