This is a forum where members new and old can come to ask questions and get info and opinions. It is not a place to advertise your business or have other forms of advertising, whether it be in your posts or signature.

All links in the forum will not be indexed by Search Engines and any unapproved forms of advertising or spam will be dealt with accordingly, deleted, and that member's account banned.

Forums

Overview » SQL and Databases » backup &restore data by procedure
Reply

backup &restore data by procedure

saraa samir
Member



Since: 07 Dec 2008
Posts: 5
Posted 07 Dec 2008 06:03:47

hi

i need to create a procedure to backup and restore data
for table with 3 coulmns(name ,phone ,ishere as boolean)

&

and another procedure delete
but when i delete name the coulmn ishere value changes into false
also on delete insert this deleted name to table(DataBackUP) and if this table doesnot exist create it

i am trying to solve them so can anybody help????


thank u

hi

i need to create a procedure to backup and restore data
for table with 3 coulmns(name ,phone ,ishere as boolean)

&

and another procedure delete
but when i delete name the coulmn ishere value changes into false
also on delete insert this deleted name to table(DataBackUP) and if this table doesnot exist create it

i am trying to solve them so can anybody help????


thank u
Roddy Dairion
Zone Manager



Since: 12 Oct 2005
Posts: 441
Replied 10 Dec 2008 19:04:35
I understand the backup and restore data.
BUT whats with the delete???
Can you explain more clearly what you're trying to achieve thank you.
saraa samir
Member



Since: 07 Dec 2008
Posts: 5
Replied 11 Dec 2008 01:34:10
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
I understand the backup and restore data.
BUT whats with the delete???
Can you explain more clearly what you're trying to achieve thank you.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Hi Roddy

i need to create a procedure that delete .

when i delete a name from the table the coulmn (Is Here) which takes values (true / false)
changes its value to false as the name is no longer in the table

also

i need to save these deleted records in another table . this new table works as abackup

can u help ? & as for the rest forget about it

Thank u
brad baker
Member



Since: 23 Oct 2008
Posts: 46
Replied 06 Jan 2009 20:00:18
This makes no sense as if you "delete" the row you cant update the is here field since it would no longer be there. If thats the case then make a trigger thats before delete.

For mysql I think its something like this: This should copy the row you are deleting to the old/current table and put it in the new table and then delete the row from the old/current table.

DROP TRIGGER trig1;

DELIMITER //
CREATE TRIGGER trig1
BEFORE DELETE ON old_table FOR EACH ROW
BEGIN
INSERT INTO new_table select from old_table WHERE current_id=OLD.current_id;
END;
//
DELIMITER ;

Reply to this topic

Message
Reply
Follow us on Facebook Follow us on twitter Subscribe to the RSS feed
Activate your free membership today | Login | Currency