Jump to Real's How-to Main page

Create a table from PowerScript

Use EXECUTE IMMEDIATE. Set Autocommit to true because DDL SQL has to be executed outside of transaction.
SQLCA.AutoCommit = True
ls_sql = "create table #tmp (abc varchar(255))"

EXECUTE IMMEDIATE :LS_SQL USING SQLCA;
To alter a table, use the same idea:
ls_sql = 'ALTER TABLE dba.tbl_name ADD col_name'
EXECUTE IMMEDIATE :LS_SQL USING SQLCA;

If you find this article useful, consider making a small donation
to show your supportfor this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]