c# - SQL Server : stored procedure to have optional parameter -
how specify default parameters stored procedures?
i have seen following 2 options.
option 1:
create procedure myprocedure(@dataone int, @datatwo int = default)
option 2:
create procedure myprocedure(@dataone int, @datatwo int = 3)
i have used stored procedure 1 single parameter in places of c# code. want use 1 optional parameter. want make sure optional parameter have default value too.
any please? have gone wrong ?
i used above 2 methods. did not work. did not default value.
the default value of parameter used if not send parameter @ all. don't send parameter code behind if want use default value. use create procedure myprocedure(@dataone int,@datatwo int=3)..
, don't send @datatwo
code behind, 3 used default value. hope helped.
Comments
Post a Comment