How to view the stored procedure code in SQL Server Management Studio

后端 未结 9 509
予麋鹿
予麋鹿 2021-01-30 19:35

I am new to SQL Server. I am logged into my database through SQL Server Management Studio.

I have a list of stored procedures. How do I view the stored procedure code?

相关标签:
9条回答
  • 2021-01-30 20:18

    This is another way of viewing definition of stored procedure

    SELECT OBJECT_DEFINITION (OBJECT_ID(N'Your_SP'))
    
    0 讨论(0)
  • 2021-01-30 20:21

    The option is called Modify:

    enter image description here

    This will show you the T-SQL code for your stored procedure in a new query window, with an ALTER PROCEDURE ... lead-in, so you can easily change or amend your procedure and update it

    0 讨论(0)
  • 2021-01-30 20:22

    I guess this is a better way to view a stored procedure's code:

    sp_helptext <name of your sp>
    
    0 讨论(0)
提交回复
热议问题