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
For stored procedures, I believe you would have to write something that parses T-SQL, or use the T-SQL parser that Microsoft provides.
The parser and script generator live in two assemblies. The
Microsoft.Data.Schema.ScriptDomcontains provider agnostic classes and theMicrosoft.Data.Schema.ScriptDom.Sqlassembly contain classes for the parser and script generator that are SQL Server specific.
How to specifically use this to identify the parameters and whether they're defaulted isn't covered and would be something you'd have to work on (probably with a deal of effort) using the sample code.