I use the following UniScript for renaming a table - it works OK for MySQL and SQLite but the MS Access doesn't run. If I remove the 'DROP TABLE..' it runs but I then have double tables. Any input to a method to use?
procedure TUniDAC.TableRename(const aOldTable, aNewTable: string);
begin
try
With frmDBConn.uniScript Do
try
begin
SQL.Clear;
SQL.Add(' {IF Access} ');
SQL.Add(' SELECT * INTO ' + aNewTable + ' FROM ' + aOldTable);
SQL.Add(' DROP TABLE ' + aOldTable);
SQL.Add(' {ELSE} ');
SQL.Add(' ALTER TABLE ' + aOldTable);
SQL.Add(' RENAME TO ' + aNewTable);
SQL.Add(' {ENDIF} ');
SQL.Add(' ;');
Execute
end;
except
on E:exception do
Logfile.Database('TUniDAC.TableRename: ' + E.Message);
end;
finally
end;
end;
UniScript multi commands
Hello,
To solve this problem you need to separate SELECT and DROP operators by semicolon:
To solve this problem you need to separate SELECT and DROP operators by semicolon:
Code: Select all
....
SQL.Add(' {IF Access} ');
SQL.Add(' SELECT * INTO ' + aNewTable + ' FROM ' + aOldTable +' ; ');
SQL.Add(' DROP TABLE ' + aOldTable);
SQL.Add(' {ELSE} ');
....After trying an update of UniDac to 4.1.3 I get another errormessage
(The update gave me the same problem as in http://www.devart.com/forums/viewtopic.php?t=22676 - removed UniDac, run CCleaner, restart, reinstall, restart = looks like working)
29-11-2011 10:00:38 # TUniDAC.TableRename: Invalid value: 1 for option ExtendedAnsiSQL
(Found the solution for that = ExtendedAnsiSQL changed from Integer to Boolean)
(The update gave me the same problem as in http://www.devart.com/forums/viewtopic.php?t=22676 - removed UniDac, run CCleaner, restart, reinstall, restart = looks like working)
29-11-2011 10:00:38 # TUniDAC.TableRename: Invalid value: 1 for option ExtendedAnsiSQL
(Found the solution for that = ExtendedAnsiSQL changed from Integer to Boolean)
Hello,
We've reproduced the problem with macros and will try to fix it in the next product version.
To solve this problem, you need to change the value of the ExtendedAnsiSQL property from 1 to True in the *.dfm file.
Code: Select all
28-11-2011 18:56:28 # TUniDAC.TableRename: {if} statement not completed Code: Select all
29-11-2011 10:00:38 # TUniDAC.TableRename: Invalid value: 1 for option ExtendedAnsiSQL