Autor Beitrag
Alfonso
Hält's aus hier
Beiträge: 7

WIN 2000
D7 Prof
BeitragVerfasst: Do 21.04.05 09:52 
Hallo alle,

ich habe folgendes Problem:

a und b sind Tabellen einer ACCESS-Datenbank, c soll neu angelegt werden mit Spalten aus a und b.

Das folgende Statement funktioniert als Abfrage in ACCESS, aber nicht über ADO.

ausblenden Quelltext
1:
2:
  
  SELECT a.*, b.Spalte1 INTO c FROM a LEFT JOIN b ON (a.Spalte1 LIKE b.Spalte2 & "" & '*');

(Ohne
Zitat:
&""& '*'
liefert es weder in ACCESS noch über ADO das gewünschte Ergebnis.)

Weiß jemand ne gute Alternative?

MfG

Alfonso

Moderiert von user profile iconChristian S.: BBCode aktiviert
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Do 21.04.05 11:01 
Hallo,

Du musst die einfachen Anführungszeichen beim Jokerzeichen durch doppelte ersetzen.
ausblenden Delphi-Quelltext
1:
2:
  ADOQuery.SQL.Text:=
    'SELECT a.*, b.Spalte1 INTO c FROM a LEFT JOIN b ON (a.Spalte1 LIKE b.Spalte2 & "*")';

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
Alfonso Threadstarter
Hält's aus hier
Beiträge: 7

WIN 2000
D7 Prof
BeitragVerfasst: Do 21.04.05 11:23 
Hallo Smiegel,

das funktioniert leider via ADO auch nicht.

Gruß,
Alfonso.
mikhal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 109

Windows 10 Professional 64-Bit
VS 215 CE, Delphi 10.1 Berlin Professional
BeitragVerfasst: So 24.04.05 09:04 
Versuch es mal mit einem '+' statt dem Access-typischen '&'.

Grüße
Mikhal

_________________
Computer erleichtern die Arbeit...
...und die Erde ist eine Scheibe!
Alfonso Threadstarter
Hält's aus hier
Beiträge: 7

WIN 2000
D7 Prof
BeitragVerfasst: Mo 25.04.05 10:08 
Hallo Mikhal,

das funktioniert leider auch nicht. Was auch in ACCESS, nicht aber via ADO, hinhaut, ist die '*' an die Einträge in b.Spalte2 anzuhängen und im ON-Statement nur
Zitat:

'ON a.Spalte1 LIKE b.Spalte2';

zu schreiben. Demnach scheint es, als ob ADO grundsätzlich ein LIKE zwischen Spalten nicht unterstützt?

ratlose Grüße
Alf
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 25.04.05 14:05 
Hallo,

wie sieht eigentlich Dein Connectionstring aus? Benutzt Du auch die MS-Jet-Engine?

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
mikhal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 109

Windows 10 Professional 64-Bit
VS 215 CE, Delphi 10.1 Berlin Professional
BeitragVerfasst: Mo 25.04.05 18:29 
Da habe ich auch nicht aufgepaßt: Access '*' entspricht dem SQL '%' sowie Access '?' dem SQL '_'.

Grüße
Mikhal

_________________
Computer erleichtern die Arbeit...
...und die Erde ist eine Scheibe!
Alfonso Threadstarter
Hält's aus hier
Beiträge: 7

WIN 2000
D7 Prof
BeitragVerfasst: Di 26.04.05 10:29 
Hallo,

@ smiegel:
Meine Anwendung erkennt verschiedene DB-Typen anhand der Dateiendung. Für ACCESS benutze ich die MS Jet Engine:
ausblenden Quelltext
1:
ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + <Filename> + ';Persist Security Info=False';					


@ Mikhal:
Du hast Recht, aber mit '%' hab ichs auch schon probiert. Ebenfalls Fehlanzeige.

Gruß
Alf

_________________
The light at the end of the tunnel might be the frontlight of an incoming train.
Alfonso Threadstarter
Hält's aus hier
Beiträge: 7

WIN 2000
D7 Prof
BeitragVerfasst: Di 26.04.05 11:06 
Hallo,

Kommando zurück! Hab wohl letzte Tage noch einen anderen Fehler gemacht. Mit '%' funktioniert es 1A.

Danke für Eure Hilfe.

Gruß
Alf

_________________
The light at the end of the tunnel might be the frontlight of an incoming train.