I've never seen a MOVE command, but I wouldn't put it past someone like
Micro$oft or Oracle to put in a proprietary SQL command that would allow you
to do that. Just a word of warning: if you do find a MOVE command (or any
such proprietary command), you're binding yourself to that particular SQL
server and you'll have to do some work whenever you may want to switch
That said, I'd stick w/ standard SQL, use the DBI module (check out its
great documentation) and write out the following pseudocode:
select * from table1 where uniqueid=####
die "No row found" if nothing found
insert into table2 values from previous select
# check and make sure it inserted (before you delete the source and is lost
die "Couldn't insert row into table2" if insert failed
delete from table1 where uniqueid=####
Check out this website: http://www.arsdigita.com/books/sql/ - pretty good
tutorial w/ some amusing pictures.
----- Original Message -----
From: "Daniel Falkenberg" <firstname.lastname@example.org>
Sent: Tuesday, July 10, 2001 2:31 AM
Subject: SQL: Moving a row from one table to another.
> I would like to be able to move a row from one table to another table
> the same database.
> Off the top of my head I suppose the SQL command would look similar to the
> my $sql = 'MOVE * FROM table1 WHERE unique_id = '1111' TO table2'. FINISH
> Then I would like to be able to do the following as well...
> my $sql = 'INSERT INTO table2 (crud, crud, crid) VALUES ('crud', 'crud',
> 'crud')' FINISH
> The second is possbile :)
> Is the first possible?
> Thanks in advance..
> Daniel Falkenberg