title image


Smiley Fehlermeldungen Syntax IF, IS
Hallo,



ich bekomme folgende Fehlermeldungen beim SQL-Server2000:



Server: Nachr.-Nr. 156, Schweregrad 15, Status 1, Zeile 1

Falsche Syntax in der Nähe des IF-Schlüsselwortes.

Server: Nachr.-Nr. 156, Schweregrad 15, Status 1, Zeile 53

Falsche Syntax in der Nähe des IS-Schlüsselwortes.

Server: Nachr.-Nr. 156, Schweregrad 15, Status 1, Zeile 62

Falsche Syntax in der Nähe des IS-Schlüsselwortes.

Server: Nachr.-Nr. 156, Schweregrad 15, Status 1, Zeile 72

Falsche Syntax in der Nähe des IS-Schlüsselwortes.



Hier das zugehörige Programm:



DROP TABLE IF EXISTS ZEA,ZEB,ZEC,ZE,TMPF,F;



CREATE TABLE ZEA (

knz CHAR(16) NOT NULL,

zeit INT NOT NULL

);

CREATE TABLE ZEB (

knz CHAR(16) NOT NULL,

zeit INT NOT NULL

);

CREATE TABLE ZEC (

knz CHAR(16) NOT NULL,

zeit INT NOT NULL

);



CREATE TABLE ZE (

knz CHAR(16) NOT NULL,

ort CHAR(1) NOT NULL,

zeit INT NOT NULL

);

INSERT INTO ZE SELECT knz,'A',zeit FROM ZEA;

INSERT INTO ZE SELECT knz,'B',zeit FROM ZEB;

INSERT INTO ZE SELECT knz,'C',zeit FROM ZEC;



SELECT * FROM ZE;

SELECT * FROM ZE ORDER BY zeit;

SELECT * FROM ZE ORDER BY knz,zeit;



CREATE TABLE TMPF (

knz CHAR(16) NOT NULL,

zeit1 INT NOT NULL,

zeit2 INT NOT NULL,

n INT NOT NULL

);

INSERT INTO TMPF

SELECT z1.knz,z1.zeit,MIN(z2.zeit),COUNT(*) FROM ZE AS z1, ZE AS z2

WHERE z1.knz = z2.knz

AND ABS(z1.zeit - z2.zeit) < 1000

GROUP BY z1.knz,z1.zeit;

SELECT * FROM TMPF;



CREATE TABLE F (

knz CHAR(16) NOT NULL,

zeit INT NOT NULL,

n INT NOT NULL

);

INSERT INTO F

SELECT knz,zeit2,n FROM TMPF GROUP BY knz,zeit2,n;



SELECT * FROM F;



SELECT F.knz,F.zeit,

ZEA.knz IS NOT NULL AS beiA,

ZEB.knz IS NOT NULL AS beiB,

ZEC.knz IS NOT NULL AS beiC

FROM F

LEFT JOIN ZEA ON (F.knz=ZEA.knz AND F.zeit= ZEA.zeit)

LEFT JOIN ZEB ON (F.knz=ZEB.knz AND F.zeit= ZEB.zeit)

LEFT JOIN ZEC ON (F.knz=ZEC.knz AND F.zeit= ZEC.zeit)

;

SELECT COUNT(*) AS n,

ZEA.knz IS NOT NULL AS beiA,

ZEB.knz IS NOT NULL AS beiB,

ZEC.knz IS NOT NULL AS beiC

FROM F

LEFT JOIN ZEA ON (F.knz=ZEA.knz AND F.zeit= ZEA.zeit)

LEFT JOIN ZEB ON (F.knz=ZEB.knz AND F.zeit= ZEB.zeit)

LEFT JOIN ZEC ON (F.knz=ZEC.knz AND F.zeit= ZEC.zeit)

GROUP BY beiA,beiB,beiC ;



SELECT COUNT(*) AS n,

ZEA.knz IS NOT NULL AS beiA,

ZEB.knz IS NOT NULL AS beiB,

ZEC.knz IS NOT NULL AS beiC,

ZEA.zeit < ZEB.zeit AS goAB,

ZEA.zeit < ZEC.zeit AS goAC,

ZEB.zeit < ZEC.zeit AS goBC,

ZEB.zeit < ZEA.zeit AS goBA,

ZEC.zeit < ZEA.zeit AS goCA,

ZEC.zeit < ZEB.zeit AS goCB

FROM F

LEFT JOIN ZEA ON (F.knz=ZEA.knz AND F.zeit= ZEA.zeit)

LEFT JOIN ZEB ON (F.knz=ZEB.knz AND F.zeit= ZEB.zeit)

LEFT JOIN ZEC ON (F.knz=ZEC.knz AND F.zeit= ZEC.zeit)

GROUP BY beiA,beiB,beiC,goAB,goAC,goBC,goBA,goCA,goCB ;





Danke schonmal,

Gruß soyo

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: