Autor Beitrag
Karstadt
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 174

Windows 2000 / XP
Delphi 7 Pro
BeitragVerfasst: Di 17.01.06 12:02 
Hallo. Wie kann ich ein AUTO_INCREMENT aktiviren?


so setze ich ein primärkey :

SQL.Text:='Create unique index primary on 010_artikel (art_id)';

wie kann ich ein AUTO_INCREMENT aktivieren ?
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Di 17.01.06 12:13 
Das kannst/musst(?) du bereits in der Spaltendefinition tun, also z.B.

ausblenden SQL-Anweisung
1:
2:
3:
4:
CREATE TABLE xyz (
  id integer not null AUTO_INCREMENT
  ...
);

_________________
Bravery calls my name in the sound of the wind in the night...
Karstadt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 174

Windows 2000 / XP
Delphi 7 Pro
BeitragVerfasst: Di 17.01.06 12:26 
sql.Add('create table '+NeueTabelle+' as Select * from '+Altetabelle+'');

ich kopieren eine Tabelle und dannach sind die primärwerte nicht mehr zusehen
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Di 17.01.06 12:32 
vllt. gehts mit nem

ausblenden SQL-Anweisung
1:
ALTER TABLE MODIFY Spalte AUTO_INCREMENT;					


wobei ich da nicht ganz fest bin in der MySQL-Syntax, was das alter table angeht...

_________________
Bravery calls my name in the sound of the wind in the night...