![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 3 of 3 total |
![]() |
Mon, Apr 14 2008 12:41 PM | Permanent Link |
"Jose Eduardo Helminsky" | Tim
Memory.Execute('create table x as select * from table2 with data'); DBISAM override the table x if it already exists. ElevateDB will raise an error if x alread exists. try Memory.Execute('drop table x'); except // Do nothing end; Memory.Execute('create table x as select * from table2 with data'); Is there another way to migrate a lot of scripts from DBISAM to ElevateDB ? Eduardo |
Mon, Apr 14 2008 2:13 PM | Permanent Link |
Roy Lambert NLH Associates ![]() | Jose
This is something Tim sent me with a bit of a mod (I think) ----------------------------------------------------------------------------------------------------------------------- SCRIPT (IN SQLStatement VARCHAR, IN TableName VARCHAR, IN IdxSet VARCHAR) BEGIN DECLARE InfoCursor SENSITIVE CURSOR FOR InfoStmt; DECLARE ResultCursor SENSITIVE CURSOR WITH RETURN FOR ResultStmt; PREPARE InfoStmt FROM 'SELECT * FROM Information.Tables WHERE Name=?'; OPEN InfoCursor USING TableName; IF (ROWCOUNT(InfoCursor) > 0) THEN EXECUTE IMMEDIATE 'DROP TABLE "'+TableName+'"'; END IF; CLOSE InfoCursor; PREPARE ResultStmt FROM 'CREATE TABLE "'+TableName+'" AS '+SQLStatement+' WITH DATA'; EXECUTE ResultStmt; IF IdxSet IS NOT NULL THEN PREPARE ResultStmt FROM 'CREATE INDEX Idx ON "'+TableName+'"('+IdxSet+')'; EXECUTE ResultStmt; END IF; END ----------------------------------------------------------------------------------------------------------------------- It works well and could be extended to analyse the statement you stuff in to extract the table name. In the example you quote you'd pass the parameters as ParamByName('SQLStatement').AsString := 'select * from table2 with data'; ParamByName('TableName').AsString := 'x'; ParamByName('IdxSet').AsString := ''; and ExecScript. Roy Lambert [Team Elevate] |
Mon, Apr 14 2008 4:41 PM | Permanent Link |
"Jose Eduardo Helminsky" | Roy
I really appreciate your help. I think it will help me a lot in my DBISAM -> ElevateDB migration. Eduardo |
This web page was last updated on Monday, July 1, 2024 at 03:00 AM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |