One comment

  1. Good article! If only more people would do it this way. In my opinion all scripts should be repeatable (without generating errors or duplicate entries).

    I’ve always been in favour of the DROP/CREATE-principle but since SQL 2005 I’m slowly converting into a believer of ALTER-statements.

    My main reason for propagating DROP/CREATE scripts was because it made it easier to distinguish the new from the old in sysobjects (or INFORMATION_SCHEMA.ROUTINES i.e. if you want). Altering an object in a pre-2005 database left the creation date intact, as it should, but nowhere was to be found when the object was last altered.

    Come SQL Server 2005, this has changed. System view sys.objects as a column named modify_date which records… well exactly that.

    What ALTER instead of DROP/CREATE? Because the latter breaks the autorisation-chain an you have to remember to script or include the GRANT-statements for your object.

    Btw, if you really really want to show of you could use these dates to determine wich objects were created and wich objects were altered by the script (record the start time) and give a summary 🙂

    Alex

Comments are closed.