Is it possible to generate an installation script in SSMS?

  • Is it possible to generate an installation script (DDL incl. triggers strored procedures, etc.) in SSMS from a database, that follows the schema and restrictions set in that database?

  • Yes, but you will need several clicks to do it...

    In SSMS, navigate to your database.
    Right-click, and, in the popup menu, go to Tasks, then "Generate Scripts".

    Lots of options in here to say which things you need to script out, but it might be easier to do "Script all objects"  
    On the next page, make sure you click on "Advanced" to bring up a box that allows you to select logins and permissions as well as anything else you might need.

    Thomas Rushton
    blog: https://thelonedba.wordpress.com

  • This seems to throw an error.

    Is there any use in sharing the log to see what is going on or does this also include information that should not be shared (student don't know everything yet :)).

  • Student031 - Friday, June 8, 2018 5:54 AM

    This seems to throw an error.

    Is there any use in sharing the log to see what is going on or does this also include information that should not be shared (student don't know everything yet :)).

    Seems?   Either it did throw an error or it didn't....  You may not have "permission" to perform that task.   There are quite a few things protected by the security that's been implemented in your SQL instance.   You may need to have "sa" rights to do certain things.   I wish I could be more specific, but I'm not all that knowledgeable about exactly how SQL Server protects things, other than to know that it does so via "permissions".   If you have the necessary permissions, you get to do a given thing.   If you don't have them, you can't do that specific thing.   Scripting out every object in a database seems to me to be something reserved for the sa login or the equivalent permissions as granted by whomever administers your SQL Server.   I may not have that totally correct, and am more than willing to be corrected by those more knowledgeable on the topic.   I also know that SQL Server can have "roles" set up, and that users can become members of those roles, and that roles can then be granted or denied permissions.

    You can at least post the error that was thrown without much concern...  and you can always anonymize any user names or logins or such...

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

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

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