I am already pulling the parameters from the stored proc sent in like this:
foreach (SqlParameter param in cmd.Parameters)
{
if (
To directly answer your question, no there is (probably) no way to determine if a stored procedure parameter possesses a default value 'in code' (i.e. using the SqlParameter
class).
In SQL Server (at least SQL Server 2005), you can query the system catalog view sys.parameters
(and join it to the catalog view sys.procedures
) and evaluate the value of the column has_default_value
.