sql server 2008 - Is it possible to set current date in stored procedure parameter? -
i want set getdate() default parameter value. shows error. below block of code:
create proc xys ( @mydate datetime = getdate() //error ) set @mydate = getdate() // can neither want nor want pass current date front end or upper layer .... ....
as far know functions/dynamic values not supported level, instead allowed hardcoded values. workaround?
would suggest using value (e.g. 0 = minimum datetime) , checking in stored proc:
create proc xys ( @mydate datetime = 0) begin if @mydate = 0 set @mydate = getdate() // ... end
Comments
Post a Comment