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关键字,略蛋疼。
查看全文
相关阅读:
PHP 页面编码声明方法详解(header或meta)
淘客部分功能实现源码
CSS3动画效果应用
JavaScript之Tab标签(原始版)
JavaScript之淡入淡出
关于响应式布局
深入理解 SVG 系列(一) —— SVG 基础
面试题
随记
一道经典面试题-----setTimeout(function(){},0)
原文地址:https://www.cnblogs.com/xiepeixing/p/2583958.html
最新文章
自定义调用 ecshop 分页代码(转)
重写ecshop分页函数get_pager
PHP_thinkphp框架使用PHPMailer实现发送邮件的功能(转+修改+亲测)
ThinkPHP实现支付宝接口功能(转)
jQuery简单的Ajax调用示例
通过JS语句判断WEB网站的访问端是电脑还是手机
又一个php与js数据交互的例子
一个js和php数据交互的例子(转)
js从数组中删除指定值的元素,而不是指定位置
从技术走向管理(一)
热门文章
Scala学习笔记三
Scala学习笔记二
Scala学习笔记一
进程与线程的区别
选择器与I/O多路复用
Java
Python之字符串函数str()
Python之删除空白
MySQL查询之关系查询
`这个符号在mysql中的作用
Copyright © 2011-2022 走看看