How do you search SQL Server for sp/func/trig source?

  • Hi,

    In Oracle there are dictionary views named DBA_SOURCE and USER_SOURCE that show all/your source lines for all of the stored procedures, functions, triggers, etc. They are very useful when you want to see which program objects will be affected by a change. Is there an equivalent in SQL Server?


    Thanks ,

    Will Dougherty

  • select * from syscomments will show you all source code from procs, views, functions etc

    or join it on sysobjects

    select o.id,o.name,c.text from syscomments c inner join sysobjects o on o.id = c.id

    MVDBA

  • Thanks Mike.  Now that I hear it, I realize that I used to know it.

    Will


    Thanks ,

    Will Dougherty

  • Theres also INFORMATION_SCHEMA.ROUTINES view which you can get at least stored procedure and function names and definitions from.  All the INFORMATION_SCHEMA views are supposed to be ANSI SQL-92 compliant, which means the same or similar queries should work in any database.  The same isn't guaranteed of system views like syscomments etc.

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

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