zoukankan
html css js c++ java
使用tsql从身份证号中提取生日
使用t-sql从身份证号中提取生日
,一下是转换16位身份证号的例子,仅供参考。
create
function
getDateFromID(
@id
char
(
15
)
)
returns
datetime
as
begin
declare
@birthPart
char
(
6
);
set
@birthPart
=
substring
(
@id
,
7
,
6
);
declare
@year
int
;
set
@year
=
cast
(
left
(
@birthPart
,
2
)
as
int
);
if
@year
<
10
SET
@year
=
2000
+
@year
;
else
SET
@year
=
1900
+
@year
;
declare
@birthday
datetime
;
set
@birthday
=
cast
(
cast
(
@year
as
char
(
4
))
+
'
-
'
+
substring
(
@birthpart
,
3
,
2
)
+
'
-
'
+
substring
(
@birthpart
,
6
,
2
)
as
datetime
)
return
@birthday
end
GO
declare
@id
char
(
16
)
set
@id
=
'
510106830328511
'
;
print
dbo.getDateFromID(
@id
)
查看全文
相关阅读:
PHP install perl module
PHP 静态页
PHP对类的操作
PHP Mysql操作。
2020.7.16
2020.7.19
2020.7.14
2020.7.12
2020.7.17
2020.7.10
原文地址:https://www.cnblogs.com/yukaizhao/p/sql_getbirthday_from_id.html
最新文章
redhat linux 配置远程桌面
linux增大SWAP分区
远程连接ASM实例总结
Oracle ASM安装指引
Linux RH5平台下使用Oracle ASM创建数据库
linux下卸载oracle
在 Rhel Linux 5.1 (32 位)上安装 Oracle ASM数据库 11g (第二部分)
ORA12546: TNS:permission denied
ASM错误集合
解决VSCode快捷键Ctrl + , 无法正常使用的问题
热门文章
IDEA中报错:找不到或无法加载主类:MyTest
IDEA编译报错:java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags
微信小程序单个页面的json文件无法覆盖app.json的问题
寻找Spring古早彩蛋文档
可能会完美解决CLion控制台中文乱码(mingw)
如何关闭PotPlayer播放器左上角的信息
微信小程序 | 去掉顶部导航栏
微信小程序学习过程BUG记录
微信小程序|底部导航栏
PHP pcel install for Debian
Copyright © 2011-2022 走看看