i'm trying write function takes input of date, , calculates difference between current day , inputed date, returns integer of days. (so if input yesterday 2015-5-8 returns 1). far i'm getting error , can't figure out what's wrong. appreciated.
create function dnevnarazlika (@odkdaj nvarchar(15)) returns int begin declare @return int select @return = datediff(day,@odkdaj, convert(date,getdate())) end return @return end
edit: using microsoft sql management studio
too end
s. try below code
create function dnevnarazlika ( @odkdaj nvarchar(15) ) returns int begin declare @return int select @return = datediff(day, @odkdaj, convert(date, getdate())) return @return end
Comments
Post a Comment