Board index » delphi » MS SQL 7 delete sql

MS SQL 7 delete sql

The following works in Interbase and Oracle, but not in MS SQL 7

DELETE FROM AccessCandidateGrids A
WHERE A.JobSkill = 1
AND EXISTS (
  SELECT * FROM AccessCandidateGrids A1
  WHERE A1.CandidateNo = A.CandidateNo
    AND A1.JobSkill = 267)

Error is 'Invalid syntax on line 1 near 'A'.

We have tried dbo. in front of each table name.  We have tried square
brackets round dbo and the tablename, but all to no effect.

Has Mr Gates in all his wisdom managed to incorporate yet another MS
standard into ANSI SQL and if so anyone any ideas what it is.

Regards

Roger Graham

 

Re:MS SQL 7 delete sql


Hi

Try  this one:

DELETE AccessCandidateGrids FROM AccessCandidateGrids AS A
WHERE A.JobSkill = 1
AND EXISTS (
  SELECT * FROM AccessCandidateGrids A1
  WHERE A1.CandidateNo = A.CandidateNo
    AND A1.JobSkill = 267)

Jan

"Roger Graham" <rgra...@designkey.co.uk> p1e v diskusnm p?spvku
news:3af8f54e$1_1@dnews...

Quote
> The following works in Interbase and Oracle, but not in MS SQL 7

> DELETE FROM AccessCandidateGrids A
> WHERE A.JobSkill = 1
> AND EXISTS (
>   SELECT * FROM AccessCandidateGrids A1
>   WHERE A1.CandidateNo = A.CandidateNo
>     AND A1.JobSkill = 267)

> Error is 'Invalid syntax on line 1 near 'A'.

> We have tried dbo. in front of each table name.  We have tried square
> brackets round dbo and the tablename, but all to no effect.

> Has Mr Gates in all his wisdom managed to incorporate yet another MS
> standard into ANSI SQL and if so anyone any ideas what it is.

> Regards

> Roger Graham

Other Threads