Viewing 2 posts - 1 through 3 (of 3 total)
There are many ways to give the right answer...
Your solution is returning me a star character (*)... A dimension musl be provided to the @result variable declaration: Declare @result VarChar(10)......
July 10, 2008 at 8:49 am
#840884
Declare @d smalldatetime
set @d = '1957/7/5'
Select DATEDIFF(yy, @d, GETDATE()) -
CASE WHEN
DATEPART(m, @d) < DATEPART(m, GETDATE())
OR (
DATEPART(m, @d) = DATEPART(m, GETDATE())
AND
DATEPART(d, @d) <= DATEPART(d, GETDATE())
) THEN 0 ELSE...
July 3, 2008 at 7:31 pm
#838182