Results 1 to 7 of 7

Thread: [RESOLVED] Get Parameter Name

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Resolved [RESOLVED] Get Parameter Name

    Hi all
    How to get the parameter name of the stored procedure in the table.
    Thanks

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Get Parameter Name

    table or database? Tables don't have stored procedures....
    That aside.... it depends on the Database you are using (SQL Server - if so, which one; Access; Oracle, etc.) And it also depends on HOW you want to do it: VB6, VB.NET, ADO, SQL, ADO.NEt, SQLDMO, SMO.....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: Get Parameter Name

    Code:
    ALTER PROCEDURE [dbo].[Award_Category_Insert] 
    -- VARIABLE DECALARTION--
    @Award_Category_Name as nvarchar(100)
    	
    AS
    BEGIN
    	SET NOCOUNT ON
    -- AWARD CATEGORY WILL BE INSERT--
    	Insert into Award_Category_Master(Award_Category_Name, Is_Deleted ) Values (@Award_Category_Name,0)
    END
    Suppose we have about SP name is Award_Category_Insert and it has 1 parameter i.e. @Award_Category_Name

    I Just want to pass the SP name in another SP and it will provide me the list of all it's parameter.

    Thanks

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Get Parameter Name

    sp_help or sp_helptext

    the first one will give the signature of the stored proc, the second will give you the actual stored proc itself.

    usage:
    Code:
    sp_help Award_Category_Insert
    sp_helptext Award_Category_Insert
    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Get Parameter Name

    Starting with version 7.0, sql server included several built in views that can be used to query the database schema. The following requires at least sql 2000 however.

    Select *
    From information_schema.parameters
    where specific_name = 'Award_Category_Insert'

    You could also use the sp_sproc_columns system stored procedure

    sp_sproc_columns 'Award_Category_Insert'

  6. #6

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: Get Parameter Name

    Thanks techgnome

  7. #7
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [RESOLVED] Get Parameter Name

    We use this stored procedure to return a list of parameters and other info from any other stored procedure

    Code:
    CREATE PROCEDURE GetSqlSP
    	 @StoredProc varchar(50)
    AS
    Select Parameter_Name,Data_Type,Parameter_Mode,Character_Maximum_Length
    From INFORMATION_SCHEMA.Parameters
    Where SPECIFIC_NAME = @StoredProc 
    Order by Ordinal_Position

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

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



Click Here to Expand Forum to Full Width