Tuesday, March 20, 2012

Script SP with permission automatically

Hi,

In enterprise manager, there is a option to automatically script any trigger, permission on a table or store procedure. It seems that this feature is gone from new the SQL management studio. Is there a way to easy script this easily just like before?

thanks,

Bernie

Hi there,

Well, you can script triggers by going to the specific table in the Object Explorer and expanding the node for that table....There should be a sub-node for triggers which you can expand to see the triggers defined on the table. Right click on the desired trigger and select "Script Trigger As" from the context menu that appears.

Note that you can take the same action for most of the other sub-nodes you see under the table such as Constraints, Indexes and Keys.

As for scripting objects with permissions, I believe that you will need to use the Script Wizard to do this. To access the wizard you right click on a database and from the context menu that appears you select: Tasks > Generate Scripts

The Script Wizard will now appear. You can run through it as follows:

1) Click the "Next>" button on the initial screen

2) Select the database you want to script and then click the "Next>" button. You can also tick the "Script All Objects In The Selected Database" option if you want to script absolutely everything

3) You will be prompted to select scripting options such as scripting object permissions, table triggers and constraints etc. Review the options and select the ones that are right for you

4) If you did not select the "Script All Objects In The Selected Database" option, you will now get to choose which database objects (e.g. stored procedures) to script and will run through a series of screens in order to make your selection

It's pretty much smooth sailing after that.

Hope that helps a bit, but sorry if it doesn't

|||

sql server management studio 2005 has a better scripting support than sql server enterprise manager 2000.

you can right click the object and the choose "script object to ; alter ; create ; delete;"

yet another way to do it is to right click the object and then choose properties

on the top portion of the properties tab there's a clcikable script dropdown which allows you to script to clipboard, file, jobs or to new query window. on the left hand side of the properties window there's a listbox with the following item geneneral,permission, extended properties. to script permission, choose permission from the list and then click the script dropdown

here's another

You can also right click the database then task then choose then choose generate scripts. this will lunch the scripts wizard which is somewaht similar to those of the EM

No comments:

Post a Comment