Dear sir,
How to find Age in stored procedure using sql server give example with coding.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kunal NaikPosted Nov 29, 2011, 1:41 AM
try this,
DECLARE @dateOfBirth DATETIME
SET @dateOfBirth = '10/13/1990'
DECLARE @age INT
SET @age = FLOOR(DATEDIFF(DAY, @dateOfBirth, GETDATE()) / 365)
DECLARE @month INT
SET @month = DATEPART(MM, @dateOfBirth)
SELECT @age as Age, @month as [Month]
Krishna GaradPosted Nov 29, 2011, 12:52 AM
Select DateDiff(year,DOBColumn,GetDate())as Age From TblName