Microsoft SQL Server Front End Blog

The writers of this blog are a part of the Microsoft SQL Server Manageability team. We will be blogging about our tools, scripts, webcasts, and miscellaneous tips that will help you get the most out of SQL Agent, Data collector and other tools

Power shell to script tables and procedures (with dependencies) and permissions

Power shell to script tables and procedures (with dependencies) and permissions

  • Comments 1

You can  use Power shell and SMO to script out objects  and its dependents in a database along with object permissions. This blogs entry has a sample power shell script that you can use to generate script in automated way.

Attachment: script_object_and_permissions.ps1
Leave a Comment
  • Please add 2 and 2 and type the answer here:
  • Post
  • The end result includes table generation script twice for the tables used by views. WithDependencies option does not only calculate dependencies and reorder them, but also add any tables needed. So the resulting script is not runnable. Is there a way to solve this problem?

Page 1 of 1 (1 items)