Dear sir,
How to find Age in stored procedure using sql server give example with coding.
Find Age
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Krishna GaradRank #191 · 12.8K reputationPosted Nov 28, 2011, 7:52 PM EST
Select DateDiff(year,DOBColumn,GetDate())as Age From TblName
Kunal Naik163 reputationPosted Nov 28, 2011, 8:41 PM EST
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]