探讨如何计算age的sql函数建站知识
导读:1建站知识复制代码 代码如下: ALTER FUNCTION [dbo].[get_FullAge] ( @birthday datetime, @currentDay 网站优化seo培训网站推广优化seo。
复制代码 代码如下: 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(YEA网站建设哪家好R, @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, @currentDayseo网站优化) = 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相关网站优化seo培训网站推广优化seo。
声明: 本文由我的SEOUC技术文章主页发布于:2023-05-24 ,文章探讨如何计算age的sql函数建站知识主要讲述函数,标签,探讨如何计算age的sql函数建站知识1网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_6248.html