sql - Coding function calculate age from a DOB -


i trying populate field in table calling following function calculate person's age dob. when execute code receive following error:

the error incorrect syntax near keyword 'end'

i don't know why? please help.

create function findage (@dateofbirth date) returns int begin return (floor(datediff(year,@dateofbirth, getdate())) end 

create function findage (@dateofbirth date) returns int begin   declare @age int;    set @age = floor(datediff(year,@dateofbirth, getdate()));   return @age; end 

Comments

Popular posts from this blog

mysql - How to unscape text from database in android studio -

php - Admin SDK -- get information about the group -

Making CSS Drop Down Menu 2 Columns -