-1

I've just created a query which involves a selection on a table created by the WITH statement; I'd like to run in on a Visual Basic 6 application (connected to the database by an ADODB object) but I got an error message "incorrect syntax near the keyword "WITH", when I use the open method of a ADODB.recordset Object; it's like Visual Basic 6 doesn't understand this statement. How could I fix this? Is there an alternative way to perform the sql's WITH statement on Visual Basic 6?

Dharma Dude
  • 559
  • 3
  • 5
  • 17

1 Answers1

2

A pound for a penny (in the absence of any more information and most likely incompleete error message) that the WITH does not have a preceeding ; because of a SET statement or DECLARE or some such.

Incorrect syntax near the keyword 'with'...previous statement must be terminated with a semicolon

Or OP is using SQL Server 2000 still...

Community
  • 1
  • 1
gbn
  • 422,506
  • 82
  • 585
  • 676
  • Indeed I just put the semicolon, but I got another error: "Incorrect syntax near 'tmp'; the query starts with: ";WITH tmp (id_area_possesso,id_area_utente,livello_accesso) AS (" – Dharma Dude Jul 11 '11 at 18:39