Showing posts with label andi. Show all posts
Showing posts with label andi. Show all posts

Monday, March 12, 2012

Retrieving Default Values for Parameters in a Stored Procedure.

I'm generating a list of parameters needed by stored procedures, andI'd like to know which ones have default values assigned to them.
To retrieve the parameter information I use:

sp_sproc_columns @.Procedure_Name='InsertUser''

However, the column that is supposed to give the default value,'COLUMN_DEF' always returns as NULL, even when that column has adefault value assigned to it.
i.e.

CREATE PROCEDURE InsertUser
@.UserID INT = 10,
....

And then if I do a sp_sproc_columns @.Procedure_Name='InsertUser'', the COLUMN_DEF value for the @.UserID column is still NULL.
Does anyone know what I'm doing wrong and how I can retrieve the default value?
Thanks

It looks like you will have to parse the stored procedure code to get the default parameter info:

http://www.aspfaq.com/show.asp?id=2463
Hope this helps.
Chris R. Timmons
--------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/