sql-servergenerate-scripts

How to create "Script Generator Options" scripts in SQL Server?


I have a SQL Server database and whenever I want to make a backup of the database, first generate a Drop and Create Script of the DB. Because by this way I can make my database in every version of SQL Server. Regardless of the version and maintenance problems of SQL.

In the Generate and Publish Scripts window of SQL Server there is an Advanced Scripting Option, as shown below:

Advanced Scripting Options

Now, I would like a script from this window to reproduce script generator advanced options. In the other words, I want a script to make script generator of my database by my selected Advanced Options.

How can I do it?


Solution

  • You can use SQL Server Profiler to retrieve executing sqls in the specified instance.

    [How to see executing batch sqls in the specified instance][1]