sybase - How do I set a default datetime parameter in a stored procedure? -
i have declared stored procedure in sybase, , 1 of parameters of type datetime. want assign datetime default value.
here's declaration:
create procedure procedure ( @fromdate datetime = getdate() ) ...
however sybase giving me error
number (102) severity (15) state (1) server (server) procedure (procedure) incorrect syntax near '('.
is possible this? if not, there workaround?
you can not use function call in default variable assignment (as found out).
set default null, , put assignment first thing in stored procedure.
create procedure procedure ( @fromdate datetime = null ) begin set @fromdate = coalesce( @fromdate , getdate() ) end
Comments
Post a Comment