sp_helptext

  • hi

    Currently i am working in one database.i want to view the stored procedures in some other database of same server without changing database by using the command sp_helptext.

    Is it possible?

  • [font="Verdana"]No you can't view. You need to select the specific database.

    Mahesh[/font]

    MH-09-AM-8694

  • Not using helptext, but it you don't mind using a query rather, this will work.

    Select name, definition

    FROM TheOtherDB.sys.sql_modules sm inner join TheOtherDB.sys.objects o on sm.object_id = o.object_id

    where name = <Name of object you're interested in>

    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
  • This answer is based on a few assumptions, and yes I do know what this translates to .... but here goes.

    If all you want to do is to dynamically view the text of SPs, Triggers, and/or functions and are using Management studio you can display the text for other databases in the same server by.

    1. Push the f8 key .. this will display the object explorer.

    2. Expand the list of databases.

    3. Expand the database you are interested in.

    4. Expand the object you are interested in - in your case expand Programmability.

    5. Expand stored procedures.

    6. Right click on the SP whose text you wish to view

    7. In the menu that displays select 'Script procedure as ..'

    8. In the next menu select 'Create' or 'Alter'

    9. Finally select where you want the script to be .. a new query window, the clipboard or to a file.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

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

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