Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary key and auto-int
Message
De
14/04/2010 13:44:44
 
 
À
14/04/2010 13:07:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01460172
Message ID:
01460180
Vues:
62
>I have a field PrimaryKey
>
>It's type is auto-int
>
>Is it possible for me to erase everything in that table and start over with 1 as the first value for the first
>record instead of what the counter is giving me by default?


Denis,

A zap does not reset the next autoinc value

You need to do that with alter table after the reset (it's mentioned in the help)
	set safety off
	
	create cursor pp ;
	(	pp I  autoinc nextvalue 0, ;
		qq I ;
	 )
	
	
	insert into pp (qq ) values (1)
	insert into pp (qq ) values (2)
	?pp && 1
	
	zap
	insert into pp (qq ) values (1)
	insert into pp (qq ) values (2)
	?pp && 3
	
	zap
	alter table pp  ;
		alter pp  I  autoinc nextvalue 0
	

	
	insert into pp (qq ) values (1)
	insert into pp (qq ) values (2)
	?pp && 1
	
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform