|
Posted by Erland Sommarskog on 09/15/05 00:19
BD (bobby_dread@hotmail.com) writes:
> I also would recommend SQL scripts over EM or any other GUI: All that
> GUIs will ultimately do is provide a nice pretty set of screens and
> buttons, and then generate a SQL script which you may or may not see.
> Getting used to coding the SQL script will eliminate the middle-man,
> and allow you to comfortably replicate the same process again and
> again.
You can use EM to get a script, that you can work from. But beware
that the script that EM generates has several flaws, that you need to
fix:
o Remove all BEGIN TRANSACTION and COMMIT TRANSACTION, except the first
BEGIN and the last COMMIT.
o Remove all GO. Instead wrap all the ALTER and CREATE TABLE statements
in EXEC.
o Add SET XACT_ABORT ON first in the script.
o Replace all WITH NOCHECK in the script WITH CHECK.
o Review the script carefully, so that it does not include changes to
do not intend to make. Yes, EM, may add such changes.
The first three points has to do with the transaction scope. You may
not always want a transaction, if you have large tables. But in such
case, you must be prepared to restore a backup if the script fails.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
[Back to original message]
|