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
)
查看全文
相关阅读:
asp后台读id设置样式
js,需要更多源字符
列名无效
asp,对待绑定数据加序号列(DataSet)
ashx 绝对路径得到物理路径
方法执行一次js
小细节
Spring oauth大致流程
第六章 分支语句和逻辑运算符
第七章 函数
原文地址:https://www.cnblogs.com/yukaizhao/p/sql_getbirthday_from_id.html
最新文章
【转】Maven最佳实践:划分模块
自定义异常的使用
TypeError: db.addUser is not a function : @(shell):1:1 ——mongoDB创建新用户名密码的方法
mongodb 的服务启动和基本操作命令
mongodb由于目标计算机积极拒绝无法连接失败
Eclipse 中 Tomcat启动卡100%(preparing launch delegate...)
jquery与各种UI框架的导入要注意的地方
java播放背景音乐的几种方式
Web API (四) 特性路由(Attribute Route)
Asp.net mvc 中的 Controller 的激活
热门文章
Asp.net mvc 中的路由
android 基础02
Web Api 2(三)之路由与Action的选择
Web Api 2 (二) 之 Action Result
C#之数组
Web API 2 (一)之Web Service简介
C#基础知识点总结
sql视图中写case判断null值
另一个SqlParameterCollection中已包含SqlParameter(转)
asp查找</td>标记时遇到以外的文件结尾
Copyright © 2011-2022 走看看