Autor Beitrag
JRegier
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Fr 10.06.05 13:25 
Hallo, ich habe ein Problem mit Leerzeichen im Feldnamen bei SQL Befehl wie wird das richtig gemacht?

ausblenden Quelltext
1:
SELECT * FROM tabelle WHERE art nr = 120    // Leerzeichen ein Problem/Fehlermeldung					


Moderiert von user profile iconChristian S.: Großschreibung aus Titel entfernt
csigg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Fr 10.06.05 13:27 
Dieses Problem hat ich heut auch schón so ähnlich, und habs nicht hingekriegt :-(
Würd mich auch mal interessieren wie das geht.
Mottor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Fr 10.06.05 13:51 
In Oracle:

ausblenden Quelltext
1:
SELECT * FROM tabelle WHERE "art nr" = 120					
Amiga-Fan
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 534



BeitragVerfasst: Fr 10.06.05 13:58 
sowas sollte man besser unterlassen, mach einen Unterstrich wenn es nötig ist. Der Anwender sieht ja die Feldnamen für gewöhnlich auch nicht.

_________________
- Leg dich nie mit einem Berufsprogrammierer an
- Wahre Profis akzeptieren keine einfachen Lösungen
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Fr 10.06.05 14:13 
user profile iconAmiga-Fan hat folgendes geschrieben:
sowas sollte man besser unterlassen, mach einen Unterstrich wenn es nötig ist. Der Anwender sieht ja die Feldnamen für gewöhnlich auch nicht.


Na ja ich bin an einem Projekt dran bei dem ich später kein Einfluß darauf habe
was für Feldnamen gewählt werden! Eine Anwendung für Datenpflege der DB'S (Universal)
hallo
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 450

WIN XP, SuSE 9.3
D3 Prof, D6 Pers, 2005 Pers
BeitragVerfasst: Fr 10.06.05 14:15 
Meines Wissens nach dürfte das kein Problem sein:
Beispie:

ausblenden Quelltext
1:
SELECT * FROM `eine tabelle in der leerzeichen sind` WHERE `feldname mit leerzeichen`='irgendwas'					


Ich probier das mal aus, ich glabe aber, dass es funktioniert!

EDIT: Ja, funcktioniert!!!!

PS: Ich verwende MYSQL!

_________________
Der beste je Programmierte Trojaner: Windows XP
Wäre es nicht adequat, den Usus heterogener Termini zu minimieren?
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Fr 10.06.05 14:35 
Vielen Dank! Hilft hoffentlich bei allen DB'S oder ist ja evtl. ANSI SQL 99
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Fr 10.06.05 18:52 
user profile iconJRegier hat folgendes geschrieben:
Vielen Dank! Hilft hoffentlich bei allen DB'S oder ist ja evtl. ANSI SQL 99


Vielen Dank hat geklappt!
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Sa 11.06.05 15:05 
user profile iconJRegier hat folgendes geschrieben:
user profile iconJRegier hat folgendes geschrieben:
Vielen Dank! Hilft hoffentlich bei allen DB'S oder ist ja evtl. ANSI SQL 99


Vielen Dank hat geklappt!


Hab doch damit ein Problem!

Also ich hatte erst so gemacht:

ausblenden Delphi-Quelltext
1:
2:
Query.SQL.Add('SELECT * FROM "'+FTableName+'" WHERE "'+RelKey+'" = :PRM');
Query.ParamByName('PRM').AsInteger := Value;


habe nachher untersucht den ganzen SQL Befehl da war nur der Parameter drin:
Also alles was nach dem = ist!

dann habe ich alles einzel Strings hinzugefügt nun stimmte das SQL Statement
aber es gab wieder ne Fehlermeldung! Habe auch mal versucht " durch ` zu
ersetzen aber das Zeichen war auch ungültig! Welches Zeichen nehme ich denn
um ein Feld/Tabellenname mit Leerzeichen zu umschließen! Ist das DB abhängig??
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Sa 11.06.05 15:36 
Versuchs mit [ und ]. So gehts bei mssql.