Board index » delphi » ISQL/w vs TQuery (MSSQL 6.5)

ISQL/w vs TQuery (MSSQL 6.5)

Hi!

When I execute the following in ISQL/w everything works fine:

IF EXISTS (SELECT name FROM tempdb..sysobjects WHERE name LIKE '#params%'
AND type='U')
  DROP TABLE #params
go
CREATE TABLE #params (  ...  )
go

But when I ExecSQL with the same SQL.Text in TQuery I get an error near
keyword 'go'
It doesn't work without 'go's, because the table is not actually dropped
when I issue the 'CREATE TABLE'.

How do I resolve it

Thanks.
Alexander

 

Re:ISQL/w vs TQuery (MSSQL 6.5)


  I think you need to execute two (three?) seperate statements.  Think of
the 'go' keyword as the ExecSQL command.  I don't think you can exexcute
multiple query statements like this using one ExecSQL call.  A stored proc
would help a lot here.  Otherwise, maybe you need three queries?  One to
query the IF EXISTS part, one to DROP, and one to CREATE.
-Howard

Re:ISQL/w vs TQuery (MSSQL 6.5)


Correct answer, go to the front of the class.
Quote
Howard Moon wrote in message <900rfs$s...@bornews.inprise.com>...
>  I think you need to execute two (three?) seperate statements.  Think of
>the 'go' keyword as the ExecSQL command.  I don't think you can exexcute
>multiple query statements like this using one ExecSQL call.  A stored proc
>would help a lot here.  Otherwise, maybe you need three queries?  One to
>query the IF EXISTS part, one to DROP, and one to CREATE.
>-Howard

Other Threads