Thanks Lena, Razzak and Buddy.
The temp table is in an item maintenance routine.  I don't want to delete it if there are other parts being edited by the same user. I was going to create a unique temp table for each part, but that got ugly real fast.

Doug

On 5/1/2018 11:04 AM, Buddy Walker wrote:

I think doing a COUNT(*) FROM  SYS_TABLES is the best way to check for an existing table. With that being said and you truly want to delete/drop a TEMPORARY table then recreate it I would just turn the error message off and drop the table then turn the error message back on.

  SET ERROR MESSAGE 2038 OFF

    DROP myTempTblName

 SET ERR0R MESSAGE 2038 ON

  CREATE TEMPORARY myTempTblName ………

Buddy

*From:*[email protected] <[email protected]> *On Behalf Of *Lena Dammstrom
*Sent:* Tuesday, May 1, 2018 11:41 AM
*To:* [email protected]
*Subject:* RE: [RBASE-L] - Does Table exist?

Doug, I be interested in a more elegant way of checking for the existence of a table too!

I use the count method:

SET VAR vCount = 0

SELECT COUNT(*) INTO vCount FROM Sys_Tables +

  WHERE Sys_Table_Name = 'TableName' AND LIMIT = 1

Regards

Lena

*From:*[email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> *On Behalf Of *Doug Hamilton
*Sent:* Tuesday, May 01, 2018 10:33 AM
*To:* R:Base List <[email protected] <mailto:[email protected]>>
*Subject:* [RBASE-L] - Does Table exist?

I'm drawing a blank - is there a command/function (in 9.5) to check for the existence of a table?
I want to see if a temp table exists before I try to recreate it.

I could try to count rows and check for error messages if the table isn't there but I suspect there's a more elegant method.
'Course, recreating an existing table would also give an error message...

TIA,
Doug
Now to get more coffee....

Image removed by sender. <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=icon>

        

Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=link>

--
For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- You received this message because you are subscribed to the Google Groups "RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to