经典qq心情,范达尔的研究,喀喇沁旗工资查询
alter function [dbo].[get_fullage]
(
@birthday datetime, @currentday datetime
)
returns int
as
begin
declare @age int
set @age = datediff(year, @birthday, @currentday)
if datediff(day, dateadd(year, @age, @birthday), @currentday) <= 0
set @age = @age - 1
if datepart(month, @birthday) = 2 and datepart(day, @birthday) = 29 and datepart(month, @currentday) = 3
and datepart(day, @currentday) = 1 and
not (year(@currentday) % 4 = 0 and (year(@currentday) % 100 !=0 or year(@currentday) % 400 = 0))
set @age = @age - 1
if @age < 0
set @age = 0
return @age
end
--sql根据出生日期计算age(不是很准确)
1. select datediff(year,emp_birthday,getdate()) as '年龄' from employeeunchangeinfo
2. floor((datediff(day,u.emp_birthday,getdate()))/365
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
-
-
-
-
-
-
-
-
-
mysql事务管理操作详解
本文实例讲述了mysql事务管理操作。分享给大家供大家参考,具体如下:本文内容: 什么是事务管理 事务管理操作 回滚点 默认的事务管理首发日期:2018...
[阅读全文]
网友评论