Autor Beitrag
Mike_C
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Fr 22.08.03 12:57 
Hi

ich will mit SQL eine Tabelle erstellen und Felder und Indizes reinschreiben.

ich hab das so probiert

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
CREATE TABLE "Conatcs.db" (Nr AutoInc, PRIMARY KEY (nr),Title character(20),Firstname character(40),Lastname character(40),Street character(40),Postcode character(6),Town character(40),Phone character(40),Mobile character(40),Fax character(40),Email character(40),Birthday date)
CREATE INDEX title ON "Conatcs.db" (Title)
CREATE INDEX firstname ON "Conatcs.db" (Firstname)
CREATE INDEX lastname ON "Conatcs.db" (Lastname)
CREATE INDEX street ON "Conatcs.db" (street)
CREATE INDEX town ON "Conatcs.db" (Town)


allesdings kann ich das SQL script nich ausfürhen, weil mir Delphi sagt
dass das KEYWORD CREATE IN ZEILE (blablabla) UNGÜLTIG BENUTZT WIRD (Invalid use of Keyword CREATE in line (blablabla).

Woran liegt das?

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Fr 22.08.03 13:03 
Index macht man doch normalerweise mit ADD INDEX?

Viele Grüße,

Matthias

_________________
Ha! Es compiliert! Wir können ausliefern!
Mike_C Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Fr 22.08.03 13:04 
auch bein nem sekundärindex?

mit ADD INDEX funktioniert das auch nicht

Fehlermeldung:

Invalide use of keyword
TOKEN: ADD
Line: 2

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Fr 22.08.03 13:49 
ALTER TABLE tabelle ADD INDEX undhierdiedefinitionweissabernichtgenauwiedieformuliertwird

Viele Grüße,

Matthias

_________________
Ha! Es compiliert! Wir können ausliefern!
Mike_C Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 207

Win XP
D7 Enterprise
BeitragVerfasst: Fr 22.08.03 13:56 
ich weiß nicht, aber irgendwie klappt das alles grade garnicht.

ich habe jetzt ein komplett neues SQL-Script geschrieben. es sieht aber so aus, als könnte ich der Tabelle keinen namen geben.

sowas wie CREATE TABLE CONTACTS "..\DB\Contacts.db" (balbalbal) funktioniert nicht.

das Script sieht so aus

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
CREATE TABLE contacts "..\DB\CONTACTS.DB" (
  ID    INTEGER NOT NULL,
  TITLE    CHAR (30),
  FIRSTNAME  CHAR (30),
  LASTNAME  CHAR (30),
  STREET    CHAR (30),
  PCODE    CHAR (6),
  TOWN    CHAR (30),
  PHONE    CHAR (30),
  MOBILE    CHAR (30),
  FAX    CHAR (30),
  EMAIL    CHAR (30),
  BIRTHDAY  DATE
);

ALTER TABLE contacts ADD INDEX TITLE ON "CONTACTS.DB" (TITLE);


entdeckt jamand den Fehler?

_________________
Life is, what some people call a mystery. To me life's just a lesson, you're learning when you're through. So why do we try to understand?