Reading code of stored procedure

  • Hello,

    I've got I stupid question and I can't find any answers on the internet. My developers need to see the code from a Stored Procedure, but may not change it.

    This give a little problem in SQL-2005, because the only person who may see AND change the code of a stored procedure is the db_owner and the sysadmin.

    Is there a workaround? Like a stored procedure that shows the code of a other stored procedure or something? Please, I need your help, if I let all my developers (10 men) to have sysadmin control, I will be in trouble very soon...

    Thanks for your reply's! Best regards,

    Mischa

  • They could use SP_HELPTEXT stored procedure or OBJECT_DEFINITION function. I think either one only requires membership in the PUBLIC role to work.

    Greg

  • Grant them view definition on the procedures, or on the entire dbo schema (but that will give them rights to see the definitions of tables, views, functions, etc as well)

    GRANT VIEW DEFINITION ON MyProc TO SomeUser

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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