Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Posts
    3

    Unanswered: Field List from a Stored procedure

    I am writing a utility that creates Java code to access a database. I am looking for a way to get a list of fields and types that are returned by an sproc. Is there any easy way to get this from the master? Do you need to parse the SQL? This list would be like what Visual Studio.NET shows, or interdev if I remember correctly.

    Thanks,

    Larry

  2. #2
    Join Date
    Jan 2004
    Location
    Boston
    Posts
    58
    not sure what exactly you looking for. try sp_helptext sproc_name

  3. #3
    Join Date
    Apr 2004
    Posts
    3
    I am looking for a way to get a list of the columns that will be in the recordset returned by a stored procedure. I need column name and type information.

    sp_helptext seems to return the full contents of the sproc, which would require that I parse this, and any linked procedures, to get the info I am looking for. This is what I am trying to avoid.

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Do your procedures do SELECT only? You can use sp_depends and retrieve the structures of all dependent tables, but this will also include fields that your procedure does not include. It'll be easier to go after views.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Apr 2004
    Posts
    3
    The procedures I am interested in do selects only. But they pull from other procedures and views.

  6. #6
    Join Date
    Apr 2004
    Posts
    1

    Field List from a Stored procedure

    I am looking for something like that as well. So far I am using sp_sproc_columns to fetch the list of params from a SQL Server stored procedure.

    There's nothing that I've found that will return a vertical list of outputs though. Ultimately I would like to display the fields returned by the sproc and their data types. Hopefully I won't have to re-invent the wheel by having to parse the sproc text.

    I'll post back if I find anything else.

    Thanks,

    Doug

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •