zoukankan
html css js c++ java
MSSQL编程笔记一初识函数
发现T-SQL还是可以像c语言的,只不过是在某些情况下。
一个十六进制转十进制的例子:
create function Hex_to_Dec(@Hex_num varchar(20)) returns int as begin declare @m int declare @return_value int set @m=1 set @return_value=0 while @m<=len(@Hex_num) begin set @return_value=@return_value+convert(int, ( case when substring(@Hex_num,@m,1)<='9' then substring(@Hex_num,@m,1) when substring(@Hex_num,@m,1)='A' then '10' when substring(@Hex_num,@m,1)='B' then '11' when substring(@Hex_num,@m,1)='C' then '12' when substring(@Hex_num,@m,1)='D' then '13' when substring(@Hex_num,@m,1)='E' then '14' when substring(@Hex_num,@m,1)='F' then '15' end ))*power(16,len(@Hex_num)-@m) set @m=@m+1 end return @return_value end
函数的写法跟c语言相似极了,只是吧几个关键字换了,在这里的case when语句,跟c语言的switch case很相似。麻烦的是每次变量赋值都要加set关键字,略蛋疼。
查看全文
相关阅读:
03《软件需求分析教程》
02《软件需求分析教程》
01《软件需求分析教程》
03《需求模式——软件建模与分析》
02《需求模式——软件建模与分析》
密码管理器
01《需求模式——软件建模与分析》
2020软件工程助教工作期末总结
第十七周助教工作周小结
第十六周助教工作周小结
原文地址:https://www.cnblogs.com/xiepeixing/p/2583958.html
最新文章
学习进度条(第十五周)
梦断代码阅读笔记02
构建之法阅读笔记06
学习进度条(第十四周)
团队项目:第二次冲刺站立会议10
团队项目:第二次冲刺站立会议09
团队项目:第二次冲刺站立会议08
“频域学习”
Mask R-CNN
FPN(Feature Pyramid Networks)
热门文章
Faster R-CNN
图像分割综述 基于区域选择(regional proposal based)
Squeeze-and-Excitation Networks(SE-Net)
ResNeXt: Aggregated Residual Transformations for Deep Neural Networks
医学图像分割综述
批量正则化(Batch Normalization)
条件随机场(Conditional Random Field, CRF)
基于SSH框架的在线考勤系统开发的质量属性
关于《实验一》的框架选择
对软件架构的认识
Copyright © 2011-2022 走看看