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
)
查看全文
相关阅读:
(转)Python中的__init__和__new__
PEP8
python lstrip()函数
python中的生成器跟迭代器
callback
关于0.0.0.0这个ip的疑问
Python import中相对路径的问题
python读取excel
git本地管理多个密钥/账户
词法分析之有确定、不确定自动机及其生成器
原文地址:https://www.cnblogs.com/yukaizhao/p/sql_getbirthday_from_id.html
最新文章
Dos命令控制网络连接禁用启用
MacOS终端控制WIFI开关
关于华为手机VulkanAPI下16张贴图的问题记录
URP下快速实现高度雾
线性代数系列之二 有限维向量空间(一)
URP下GPU Instance以及IndirectDraw探究
关于UnityEditor导致系统无法转移焦点的问题
Unity粒子系统(ParticleSystem)动态修改某些字段导致的问题
Unity快速实现平行光体积光(URP)
U3D模拟暗黑泰瑞尔翅膀物理运动效果
热门文章
3Dmax制作页游简单草地
3Dmax批量展开场景物体的第二套UV
写实材质贴图转换成Q版贴图制作步骤
Unity树木生成器
Drawcall总结-Unity5.X
其他软件烘培的光影贴图在unity中如何使用
图片占用内存计算
批量修改文件后缀名
python中str()与repr()区别
UnicodeEncodeError: 'ascii' codec can't encode character u'u6211' in position 0: ordinal not in range(128)
Copyright © 2011-2022 走看看