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
)
查看全文
相关阅读:
AtCoder Beginner Contest 113 D Number of Amidakuji
UVA
mt19937 -- 高质量随机数
牛客网NOIP赛前集训营-提高组(第七场)C 洞穴
牛客OI周赛4-提高组 C 战争(war)
牛客OI周赛4-提高组 B 最后的晚餐(dinner)
bzoj 4318 || 洛谷P1654 OSU!
Tourists Codeforces
bzoj 1791 [Ioi2008]Island 岛屿
洛谷 P2231 [HNOI2002]跳蚤
原文地址:https://www.cnblogs.com/yukaizhao/p/sql_getbirthday_from_id.html
最新文章
POJ3696 The Luckiest Number
LightOJ1199 Partition Game
LightOJ 1253 Misere NIM(反NIM博弈)
LightOJ 1186 Icreable Chess(Nim博弈)
LightOJ1355 Game Of CS(green 博弈)
HDU1079 Calender Game
2018-2019 ACM-ICPC Pacific Northwest Regional Contest (Div. 1)
Codeforces 1079 E
牛客OI周赛6-提高组 B 践踏
牛客OI周赛6-提高组 A 大法师与魔法石
热门文章
UVA
2018 AICCSA Programming Contest
Semana i 2018
EOJ Monthly 2018.11 D. 猜价格
Codeforces 1077 F2
Codeforces 1062 E
Codeforces 1071 C
Codeforces 1076 E
Codeforces 1073 E
Codeforces 1043 F
Copyright © 2011-2022 走看看