Select from Stored Procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lawardy
    New Member
    • Sep 2007
    • 5

    Select from Stored Procedure

    Hi,


    Please help. I am very new to SQL server.

    I run :

    sp_helprotect erwin123

    Owner object grantee grantor protecttype action coloumn
    dbo erwin123 developer_user dbo Deny Select (All+New)
    dbo erwin123 laue dbo Grant Select(All+New)

    If I Just want to get the 3rd column which in grantee, what manipulation on stored procedure can I use.

    I've tried something like

    select grantee from (exec sp_helpprotect erwin123) and it does not work.

    Thanks in advance for your advice
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    Originally posted by lawardy
    Hi,
    I've tried something like

    select grantee from (exec sp_helpprotect erwin123) and it does not work.
    Hi lawardy
    You cannot query a stored procedure like that.

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      You can try converting the sp into a table-function

      -- CK

      Comment

      • lawardy
        New Member
        • Sep 2007
        • 5

        #4
        Hi,

        I manage to do it by creating a Temp table. However it only work as long as the SP_* return only 1 rowset.

        Something like SP_HELP which return multiple rowset may need another trick

        Comment

        • ck9663
          Recognized Expert Specialist
          • Jun 2007
          • 2878

          #5
          As everyone recommended, try function

          -- CK

          Comment

          Working...