ExecuteSQL Err - Table already exists 
Author Message
 ExecuteSQL Err - Table already exists

Howdy All. Thanks to Fredric Bouchard (pardon spelling, if mangled,
doing this from mem vice msg) for prev SQL tip.
However, I have a new problem when converting old code which used
ExecuteSQLString to readFromString and ExecuteSQL. BTW, ExecuteSQLstring
also worked w/initial batch then gave a similar err. You are able to
complete processing batch after getting err when exiting Paradox
completely and restarting Paradox...Problem w/following code is that
when run with initial batch it works - at least, it did before I started
"mangling the code."

However, with the the next batch gives the error:
An error was triggered in the ExecuteSQL method of an object of SQL
type. >> File already exists. Table: C:\acstest\private\statchg.db.

I'm not sure if issue is problem is deleting table or with SQL string
passed to ExecuteSQL. Aliases point to local tables for testing but
production tables are located on an NTServer 4.0 w/SP5 box. Users are
mix of W95/98 and NT4 workstations.

Additionally, having researched this newsgrp on ExecuteSQL found that
maybe I should also add quotes around fieldnames...still same err. Have
not tried to see what results obtained if I enter statement in Local SQL
editor and save then insert into code below.

Thanks in advance for any help/suggestions on this issue.

Rey

; Print the DQStatus Change report
var
  dbpriv  database
  thesql  string
  therep  report
  thenews ReportPrintinfo
  thefile string
  thetable table
  SQLVar                SQL

  FS                    Filesystem
  DeleteDB      String
endvar

if not dbpriv.open(":PRIV:") then
  errorshow()
  msginfo("Report problem","Unable to print Status Change Report")
endif

DeleteDB="C:\\acstest\\private\\statchg.db"

if fs.findFirst(DeleteDb) THEN                  <-- changed code from
istable()..delete() below to this
        fs.delete(deleteDB)                     <-- same err
        message(":PRIV:statchg.db deleted!")
EndIF

SLEEP(1000)

{
thetable.attach(":PRIV:statchg.db")
if thetable.istable() then
  thetable.delete()
  message(":PRIV:statchg.db deleted!")
  SLEEP(200)
endif
thetable.unattach()

Quote:
}

thefile = "\":PRIV:" + string(batchnum) + "bat\""

thesql = "SELECT DISTINCT d.\"UnitNumFK\", d.\"AssnNumFK\",
d.\"DQStatBefore\", d.\"DQStatAfter\",
          d.\"ItemNum\", D1.\"StAddress\", ((D2.\"LastName\" || ', ') ||
D2.\"FirstName\") AS Fullname
          FROM " + thefile + " d,\":haidata:Unitmast\"
D1,\":haidata:peplmast\" D2
          WHERE (d.\"DQStatBefore\" <> 'CU') AND (d.\"DQStatAfter\" =
'CU')
          AND (D1.\"UnitNumPK\" = d.\"UnitNumFK\") AND (D2.\"PeplNumPK\"
= D1.\"PeplNumFK\")"

; changed from executeSQLString to ReadFromString w/executeSQL
SQLVar.readFromString(theSQL)
IF NOT SQLVar.executeSQL(dbpriv,":PRIV:statchg.db") THEN
        errorshow("SQLVAR did NOT run!")
ELSE
        message("SQLVAR ran")
EndIF

Original code which also experienced err....
{if not executeSQLstring(dbpriv,thesql,":PRIV:statchg.db") then
  beep()
  msginfo("messed up","prtDQstatchg")
  errorshow()
  return
endif

Quote:
}



Sun, 08 Sep 2002 03:00:00 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Err: Temporary table object already in database.

2. How to check if a table already exists

3. vb: check if table already exists??

4. check if table already exists??

5. How to check if an tempory table already exists

6. Temporary Table already exists

7. table already exists ???

8. an already existing alter table drop column ?!?!?!

9. add new table unless already exists

10. Add a new Database field to a already-existing Paradox table at RUNTIME

11. How to find out if a table already exists with PL/SQL

12. table already exists error


 
Powered by phpBB® Forum Software