Calculate exact age in SQL Server 2005

This is a function to calculate the exact age or a person in sql server 2005…

CREATE FUNCTION [dbo].[fn_Edad] (@FecNac DATETIME, @FecHoy DATETIME)
RETURNS VARCHAR(7)
AS
BEGIN

DECLARE @ANO VARCHAR(3)
DECLARE @MES VARCHAR(3)

SET @ANO = YEAR(@FecHoy) - YEAR(@FecNac)

IF MONTH(@FecNac) > MONTH(@FecHoy)
BEGIN
SET @ANO = @ANO - 1
SET @MES = 12 - (month(@FecNac) - month(@FecHoy))
END

IF MONTH(@FecNac) < MONTH(@FecHoy)
BEGIN
SET @MES = (MONTH(@FecHoy) - MONTH(@FecNac))
END

IF MONTH(@FecNac) = MONTH(@FecHoy)
BEGIN
IF DAY(@FecNac) <= DAY(@FecHoy)
BEGIN
SET @MES = 0
END
IF DAY(@FecNac) > DAY(@FecHoy)
BEGIN
SET @ANO = @ANO - 1
SET @MES = 11
END
END

RETURN RIGHT('  ' + @ANO,2) + 'a ' + RIGHT('  ' + @MES,2) + 'm'

END

Tomcat Fails to Launch on Windows 2003 Server

The current Tomcat installer has a bug where it forgot to install one Windows dll.

The solution is to copy a C:\WINDOWS\System32\msvcr71.dll from any Windows system you find it (like XP Pro or Vista or any Windows computer with a Microsoft Visual Studio installed) and copy it to the same directory on your Windows 2003 Server machine.

Then Tomcat will launch fine.

Here’s the file if you need to download it: msvcr71.dll