June 2, 2014 at 3:01 pm
I have various ways of getting the parameters of a stored procedure:
I have a procedure that has all defaults 4 are null and 2 are 0.
The following shows most of what I need but no defaults
SELECT PARAMETER_NAME ,
ORDINAL_POSITION ,
DATA_TYPE ,
CHARACTER_MAXIMUM_LENGTH ,
CHARACTER_OCTET_LENGTH ,
NUMERIC_PRECISION ,
NUMERIC_PRECISION_RADIX
FROM information_schema.parameters
WHERE specific_name = 'procedure'
This one has two values: has_default_value (which always is 0) and default_value (which always shows null)
SELECT *
FROM sys.procedures sp
JOIN sys.parameters parm ON sp.object_id = parm.object_id
JOIN sys.types typ ON parm.system_type_id = typ.system_type_id
WHERE sp.name = 'procedure'
This one has two values: PARAMETER_HASDEFAULT (always 0) and PARAMETER_DEFAULT (always 0)
sp_procedure_params_rowset proc procedure
Is there something else that would tell me if there is a default on a parameter and what the default is if there is one.
Thanks,
Tom
June 2, 2014 at 9:08 pm
Not without dissecting the code as only CLR procedure parameter defaults are listed in sys.parameters. More can be found here http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=234143%5B/b].
😎
June 3, 2014 at 6:58 am
Interesting... this is the second time in a week that someone has asked this very rare question. I'm just curious... is this a school assignment or are you working on a project with a fellow that goes by the handle of "ramana" on this site?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply