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

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

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -