Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 2 of 2 total |
if exists |
Mon, Nov 12 2007 5:26 AM | Permanent Link |
"Harry de Boer" | Tim,
I used in dbIsam scripts like: DROP TABLE IF EXISTS memory tmpJTOV; SELECT extract(month from Datum) AS maand, SUM(Bedrag) AS bedr INTO memory tmpJTOV so that there was no error executing the script the second time (when tmpJOV was created). What's the proper way to do this in EDB 1.06? Regards, Harry |
Mon, Nov 12 2007 6:10 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Harry,
<< I used in dbIsam scripts like: DROP TABLE IF EXISTS memory tmpJTOV; SELECT extract(month from Datum) AS maand, SUM(Bedrag) AS bedr INTO memory tmpJTOV so that there was no error executing the script the second time (when tmpJOV was created). What's the proper way to do this in EDB 1.06? >> You should probably use a temporary table intead because it avoids a lot of database switching: SCRIPT BEGIN DECLARE TempCursor CURSOR FOR stmt; PREPARE stmt FROM 'SELECT * FROM Information.Tables WHERE Name = ?'; OPEN TempCursor USING 'TmpJTOV'; IF (ROWCOUNT(TempCursor) > 0) THEN EXECUTE IMMEDIATE 'DROP TABLE tmpJTOV'; END IF; CLOSE TempCursor; EXECUTE IMMEDIATE 'CREATE TEMPORARY TABLE tmpJTOV AS SELECT extract(month from Datum) AS maand, SUM(Bedrag) AS bedr FROM MyTable WITH DATA'; END |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |