I\'m writing a C# routine to call a stored proc. In the parameter list I\'m passing in, it is possible that one of the values can legally be null. So I thought I\'d use a
In your stored proc when you declare the incoming variable, have it set the var equal to null and then do not pass it in from your csharp code, it will then pick up the default value from sql
@theParam as varchar(50) = null
and then in your csharp
if (theParam != null)
cmd.Parameters.Add(new SqlParameter("@theParam", theParam));
This is how I usually pass option and/or defaulted values to my stored procs