January 4, 2022 at 11:05 am
How to execute "Generate scripts" option for database with minimum privilege ?
I am using "Generate scripts" for "Types of data to script" - Schema only option.
There are some confidential data in some database , hence we don't want to give other user data view/modify permission.
Is it possible to give a User/login "view only schema" permission and execute "Generate scripts"?
We have tried below query but didn't help
USE master
GO
GRANT VIEW ANY DEFINITION TO user_name
If not possible is there any other method to get Design information with minimum permission?
January 4, 2022 at 7:04 pm
I think I am a bit confused by the question. My understanding of the "Generate Scripts" button is that it is used when performing an administrative related task and you want to script it out such as when doing a backup.
I think in order to use the "Generate Scripts" button, you would need permissions to view and edit values in the window where that button is presented.
Now, if you wanted to view the definition of an object (such as a table or view), the View any definition permissions should be sufficient to view the definition without viewing the data, just maybe not from the window you are trying to use. But you should be able to use the stored procedure sp_helptext to view the definition of any objects IF you have the View Definition permission (for example).
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply