Autor Beitrag
Hendrik
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324



BeitragVerfasst: Mo 19.01.04 20:03 
Hey!


Wie kann ich denn überprüfen, ob ein Feld in einer Tabelle vorhanden ist und bei nichtvorhandensein dieses Feld hinzufügen?
KidPaddle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 351

WinXP,Linux
D7 Prof, XE7
BeitragVerfasst: Di 20.01.04 08:33 
Die gleiche Frage, welche Datenbankbank?

Ansonsten schau Dir mal die SQL Anweisung ALTER TABLE an.

Gruß
KidPaddle
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Di 20.01.04 11:26 
Bei den IBX gibt es eine Funktion GetFieldNames bei der Database-Kompo. Wirds wohl auch unter der BDE geben. Damit kannst Du die Feldnamen einer Tabelle auslesen. Mit einem Query kannst Du dann ganz einfach ein Feld hinzufügen:
ausblenden Quelltext
1:
ALTER TABLE tabelle ADD feldname typ					

Freid ausm Gedächtnis raus, also ohne Gewähr ;-)
Hendrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324



BeitragVerfasst: Mo 26.01.04 21:12 
Hm. Muss ich da nicht noch irgendwo die Feldlänge angeben?
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Di 27.01.04 00:54 
Das kommt auf den Typ, z.B. musst Du bei VARCHAR die Feldlänge dahinter in () angeben, bei DECIMAL musst Du Genauigkeit (glaub ich) und Anzahl der Nachkommastellen mit , getrennt in () dahinter angeben, bei int musst Du gar nichts angeben. Ist also unterschiedliche, je nachdem, was für einen Typ du haben willst.