- 1、本文档共43页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
E6的推算,分拆值等经典SQL源码及分析
E6的推算,分拆列值等经典SQL源码及分析
--查询表的默认值
if object_id(tb) is not null
drop table tb
go
create table tb(id int,name varchar(50) default abc,num int default 5)
insert into tb(id) select 1
insert into tb select 1,oo,100
insert into tb(id,name) select 1,oo
go
declare @tbname varchar(50)
set @tbname=tb--表名
select @tbname as tbname, as colname,replace(replace(replace(replace(b.[text],(,),),),((,),)),) as defaultvalue
from sysconstraints a join syscomments b on a.constid=b.id
join syscolumns c on a.id=c.id and a.colid=c.colid
where a.id=object_id(@tbname) and object_name(a.constid) like %df%
SQL code--存储过程语句查询
if object_id(proc_ttt) is not null
drop proc proc_ttt
go
create proc proc_ttt
as
select 1 union select 2
go
select [text] from syscomments
where id=object_id(proc_ttt)
EXEC SP_HELPTEXT proc_ttt
--通过身份证获得户籍
create function f_getcityfromcid (@cid varchar(18))
returns varchar(50)
as
begin
declare @acity varchar(1000)
set @acity = ____,____,____,____,____,____,____,____,____,____,____,北京__,天津__,河北__,山西__,内蒙古_,____,____,____,____,____,辽宁__,吉林__,黑龙江_,____,____,____,____,____,____,____,上海__,江苏__,浙江__,安微__,福建__,江西__,山东__,____,____,____,河南__,湖北__,湖南__,广东__,广西__,海南__,____,____,____,重庆__,四川__,贵州__,云南__,西藏__,____,____,____,____,____,____,陕西__,甘肃__,青海__,宁夏__,新疆__,____,____,____,____,____,台湾__,____,____,____,____,____,____,____,____,____,香港__,澳门__,____,____,____,____,____,____,____,____,国外__,
set @cid = upper(@cid)
IF (len(@cid) 18 OR patindex(%[^0-9X]%,@cid) 0)
RETURN 你小子骗我,这不是合法的身份证
IF substring(@acity,cast(left(@cid,2) as int)* 5+1,4) =
RETURN 你小子骗我,这身份证的地区码不存在
RETURN 这小子是:+replace(substring(@acity,cast(left(@cid,2) as int)* 5+1,4),_,)
end
go
select dbo.f_getcityfromcid(32108519760502ttt9)
/*
你小子骗我,这不是合法的身份证
(所影响的行数为 1 行)
*/
select dbo.f_getcityfromcid***026**9)
/*
这小子是:江苏
(所影响的行数为 1 行)
*/
drop function f_getcityfromcid
--随机选择
您可能关注的文档
最近下载
- 2022年会理县社区工作者招聘笔试试题及答案解析.docx VIP
- 2025年人教版四年级下册语文期末考试题(5套)及答案.docx VIP
- 医院医疗设备维修工作流程.docx VIP
- 2023地下工程止水帷幕施工技术规程.docx VIP
- 2022HY6102BG消防应急广播设备安装使用说明书.docx VIP
- 2025精准饲喂使用说明书.pdf VIP
- AWC NDS-2018 木材建筑国家设计规范(NDS).pdf VIP
- (含土建井道及电梯安装施工方案)既有住宅老旧小区加装电梯项目施工组织设计方案.doc VIP
- 偏心受压构件承载力.doc VIP
- 幼儿园开展民间游戏存在的问题及改进策略.docx VIP
文档评论(0)