How can I determine if a SQL Server stored procedure parameter has a default?

后端 未结 7 1860
青春惊慌失措
青春惊慌失措 2020-12-11 03:08

Is there a way to determine programmatically if a SQL Server stored procedure parameter has a default? (Bonus points if you can determine what the default is.) SqlCommandB

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 03:43

    This is kind of a hack, but you could always just give optional parameters a special name like:

    @AgeOptional = 15

    ...then write a simple method that checks a parameter to see if it's optional. Not ideal, but given the situation, it might actually be a decent solution.

提交回复
热议问题