Generate SQL Script for UDFS may lose table data

  • I just learned this the hard way:

    If you run Generate Scripts, and ask for all user-defined functions, it is important to make sure that "script all dependent objects" be unchecked, no matter how plausible it sounds, because it will drop any referenced tables, thus losing your data.

  • Never script with Drop option for any types of objects unless you are absolutely sure. "Generate the DROP command" checkbox  is on the Formatting tab of the Generate SQL Scripts window, I mostly uncheck that.

    Regards,Yelena Varsha

  • Oh, yes, I'm familiar with that checkbox -- if I don't check it, there will be many errors due to the old versions, and they won't get upgraded, so I won't accomplish the task.

    This goes to what I see as a huge flaw in MS SQL Server, that they don't have the nice "CREATE OR ALTER" statement that is so convenient in Oracle.

    As it happens, I didn't lose any data -- I'm not quite as stupid as I look/sound -- but lost some time, due to having to recopy the many hundreds of tables back over to this working area.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply