Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
if temporary table exists |
Mon, Nov 12 2007 12:03 PM | Permanent Link |
L Duncan | I am trying to find out if a temporary table exists before
dropping it and creating again using the following code: with memorydatabase do begin Connected := True; Open; //if the memory table exists then drop if (Execute('SELECT * FROM Information.Tables WHERE Name='+Engine.QuotedSQLStr('PlanHoldings'))=1) then Execute('DROP TABLE "PlanHoldings"'); Execute('CREATE TEMPORARY TABLE ...'); Close; end; Unfortunately I think it is the if (Execute('SELECT * FROM Information.Tables WHERE Name='+Engine.QuotedSQLStr('PlanHoldings'))=1) then that is not picking up the existence of the table, although I do get errors stating it exists when I try and create it. regards |
Mon, Nov 12 2007 7:33 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << Unfortunately I think it is the if (Execute('SELECT * FROM
Information.Tables WHERE Name='+Engine.QuotedSQLStr('PlanHoldings'))=1) then that is not picking up the existence of the table, although I do get errors stating it exists when I try and create it. >> Temporary tables do not show up in the catalog tables. You'll have to just enclose the DROP TABLE statement inside of an EXCEPTION block: BEGIN EXECUTE IMMEDIATE 'DROP TABLE...'; EXCEPTION END -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Nov 13 2007 6:40 AM | Permanent Link |
L. Duncan | "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:
BEGIN EXECUTE IMMEDIATE 'DROP TABLE...'; EXCEPTION END Thank you, much appreciated. regards |
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |