I want to hide the script of a stored procedure in SQL Server 2008

后端 未结 4 1494
温柔的废话
温柔的废话 2021-02-15 14:27

I have written a stored procedure in SQL Server.

Now its just that I don\'t want any one to see my script or edit it.

Please remember that I am working on the a

4条回答
  •  长发绾君心
    2021-02-15 15:22

    Avoid using the WITH ENCRYPTION option other than for very specified requirements. It may lead to administrative problems later.

    Using WITH ENCRYPTION is not a recommended best practice to hide the definition/code of an object. Luckily, there is an alternative approach for SQL Server.

    If it is required to hide the definition/code of any object from a user then standard permissions can be used for this purpose. This can be done by granting or revoking View Definition rights.

    If permission View Definition is denied for an object to any user then the user would not be able to view the object in SSMS or view its code through the system stored procedure sp_helptext.

    The View Definition permission may also be used for other objects in SQL Server like tables, synonyms etc. View Definition permissions can be granted or denied using both T-SQL or SSMS

    For implementation of permissions through SSMS :

    1. Right click on the object that is required to hide the definition
    2. Click on Properties, a frame will appear, select grant or deny View Definition permission on the object for the selected user or role

    Denying View Definition permission will hide the object for a specific user and also the user will not be able to see the definition using sp_helptext

    Other permissions like SELECT, INSERT etc will remain intact.

    The permissions are flexible and can be implemented on the following four levels:

    1. Server level. At server level this permission will be listed as View Any Definition 2 .Database level
    2. Schema level
    3. Individual entity level

    Thank you hope it will clear confusion.

提交回复
热议问题