Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Turning tables to have auto increment
Message
 
 
À
03/03/2006 15:25:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01101377
Message ID:
01101395
Vues:
11
This message has been marked as the solution to the initial question of the thread.
>I have a project where I have about 80 tables. They all have the field Numero as Integer. This field serves for the primary key. I have a Table.dbf which contains all the names of those 80 tables as well as a field Table.LastID which holds the current last primary key of each of those tables. I need to scan Table.dbf and apply the following process for each of those 80 tables:
>
>1. Open the table in exclusive use
>2. Alter the structure of Numero field to be Auto Increment
>3. Adjust the table auto increment functionality so it would start from the value of Table.LastID
>
>It is basically point 3 which causes me a problem. By default, changing the structure to Auto Increment makes the current primary key to be 0. I need it to be set to Table.LastID.

ALTER TABLE TableName1 ADD | ALTER [COLUMN] FieldName1
FieldType [( nFieldWidth [, nPrecision])] [NULL | NOT NULL] [CHECK lExpression1 [ERROR cMessageText1]]
[AUTOINC [NEXTVALUE NextValue [STEP StepValue]]]

What seems to be the problem?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform