Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 3 of 3 total |
Drop table by the script |
Fri, Apr 15 2016 5:15 AM | Permanent Link |
宮腰 具明 SISAN SYSTEM RESEARCH. Co. Ltd. | Hi there ...
I tried to go the execution of the following. SCRIPT() BEGIN IF EXIST DROP TABLE "DUST_Table" END It did not work. > The IF EXISTS clause is no longer supported. ElevateDB uses catalog queries to determine > if a table exists. Please see the System Information topic for more information. mmm... Then, I wrote the following script. SCRIPT() BEGIN IF SELECT COUNT(*) FROM Information.Tables WHERE NAME="DUST_Table" = 1 THEN EXECUTE IMMEDIATE 'DROP TABLE ""DUST_Table"'; END IF; END it did not work Please tell me the way. |
Fri, Apr 15 2016 6:07 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tomoaki
>SCRIPT() >BEGIN > IF SELECT COUNT(*) FROM Information.Tables WHERE NAME="DUST_Table" = 1 THEN > EXECUTE IMMEDIATE 'DROP TABLE ""DUST_Table"'; > END IF; >END Guessing from your comment about IF EXISTS you come from DBISAM. Scripts in ElevateDB are totally different and you can't just place a line of SQL and expect it to work. You have a number of options: 1. SImplest SCRIPT() BEGIN BEGIN EXECUTE IMMEDIATE 'DROP TABLE DUST_Table'; EXCEPTION END; END 2. Like yours SCRIPT() BEGIN DECLARE HowMany INTEGER; EXECUTE IMMEDIATE 'SELECT COUNT(*) INTO ? FROM Information.Tables WHERE NAME = ' +QUOTEDSTR('DUST_Table') USING HowMany; IF HowMany = 1 THEN EXECUTE IMMEDIATE 'DROP TABLE ""DUST_Table"'; END IF; END 3. Similar to the above but using internally declared cursors rather than an EXECUTE IMMEDIATE SCRIPT BEGIN DECLARE InfoCursor SENSITIVE CURSOR FOR InfoStmt; PREPARE InfoStmt FROM 'SELECT * FROM Information.Tables WHERE Name=?' /* Drop the table if it exists */ OPEN InfoCursor USING 'DUST_Table'; IF (ROWCOUNT(InfoCursor) > 0) THEN EXECUTE IMMEDIATE 'DROP TABLE DUST_Table'; END IF; END Roy Lambert |
Sun, Apr 17 2016 7:54 PM | Permanent Link |
宮腰 具明 SISAN SYSTEM RESEARCH. Co. Ltd. | Roy
Thank you. Rewrite the script in a way that use the "exepution". Tomoaki Miyakoshi |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |