Reputation: 14433
I know how to execute single statements, but is their a way to execute a block of statements in some easy way. I just want to delete a column from a table.
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE t1_backup(a,b);
INSERT INTO t1_backup SELECT a,b FROM t1;
DROP TABLE t1;
CREATE TABLE t1(a,b);
INSERT INTO t1 SELECT a,b FROM t1_backup;
DROP TABLE t1_backup;
COMMIT;
Upvotes: 2
Views: 3156
Reputation: 14433
Looks like the only way is to execute each line as a separate query and create a transaction. I wish there should be some API to execute a bunch of queries at once.
Upvotes: 1
Reputation: 69342
It looks like you have this solved already. I don't think there's a better solution than what you posted in your question.
Upvotes: 0