Autor Beitrag
axlegolas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN 2000, WIN XP
D 6,D 2006, C#
BeitragVerfasst: Mi 15.02.06 12:05 
Hallo zusammen,

wollte nur kurz fragen, ob ich mit ALTER TABLE in meiner SQL Anweisung auch einen Standardwert für Spalten setzen kann und wenn 'Ja' wie?

Syntax:

ausblenden SQL-Anweisung
1:
2:
ALTER TABLE DerivPos_Tab
ADD Hoc INTEGER;


Moderiert von user profile iconraziel: SQL-Tags hinzugefügt

_________________
Jene Menschen die zu Tage träumen sind gefährliche Menschen, denn ihre Träume sind Träume der Veränderung und des Chaos.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 15.02.06 12:15 
Beispiel:
ausblenden SQL-Anweisung
1:
2:
ALTER TABLE DerivPos_Tab
ADD Hoc INTEGER DEFAULT 0 NOT NULL

Vorgabe ist 0 und das Feld muss etwas enthalten (NOT NULL).
axlegolas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN 2000, WIN XP
D 6,D 2006, C#
BeitragVerfasst: Mi 15.02.06 12:21 
Er nimmt aber die 0 nicht an....'Syntaxfehler'!!!

_________________
Jene Menschen die zu Tage träumen sind gefährliche Menschen, denn ihre Träume sind Träume der Veränderung und des Chaos.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 15.02.06 12:34 
Welche DB setzt du ein?
axlegolas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN 2000, WIN XP
D 6,D 2006, C#
BeitragVerfasst: Mi 15.02.06 12:40 
Ich muß eine Access-db benutzen.

_________________
Jene Menschen die zu Tage träumen sind gefährliche Menschen, denn ihre Träume sind Träume der Veränderung und des Chaos.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 15.02.06 12:56 
Bei Access geht das evtl. nicht mit Alter Table. (Habe gerade mal gegoogletSuche bei Google ACCESS ALTER TABLE DEFAULT).
axlegolas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN 2000, WIN XP
D 6,D 2006, C#
BeitragVerfasst: Mi 15.02.06 13:34 
Habe herausgefunden, daß man die DEFAULT Anweisung nur über Code eingeben kann(mit ADO):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
pTableCheck: TADOQuery;

With pTableCheck do begin
   SQL.Clear;
   SQL.Add('ALTER TABLE '+DerivPos_Tab);
   case VN of
     2: SQL.Add('ADD Azubi INTEGER DEFAULT 0');
   end;
   ExecSQL;
end;


Trotzdem danke für den Hinweis!!!

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt

_________________
Jene Menschen die zu Tage träumen sind gefährliche Menschen, denn ihre Träume sind Träume der Veränderung und des Chaos.