Given that there are is no "UNDO" feature in SQL, says my textbook,
what are the best practices in SQL to avoid making a irreversible
mistake? For example, backup your database prior to modifying it with
an UPDATE command, or, make a copy of a table with SELECT * prior to
modifying a table?
RL"raylopez99" <raylopez99@.yahoo.com> wrote in message
news:1185342099.040833.177280@.d55g2000hsg.googlegroups.com...
> Given that there are is no "UNDO" feature in SQL, says my textbook,
> what are the best practices in SQL to avoid making a irreversible
> mistake? For example, backup your database prior to modifying it with
> an UPDATE command, or, make a copy of a table with SELECT * prior to
> modifying a table?
> RL
>
The answer depends on the context. If you are performing some one-off
maintenance task then do it in a transaction and verify the results
immediately. Only commit if the test is good. Of course you would always
have a backup anyway wouldn't you?
In an application context you might decide to preserve a history of changes
or just rely on FULL RECOVERY and point-in-time restore.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
No comments:
Post a Comment