博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
转载 sql 首字母大写
阅读量:4584 次
发布时间:2019-06-09

本文共 1010 字,大约阅读时间需要 3 分钟。

CREATE FUNCTION [dbo].[CapitalizeFirstLetter] ( --string need to format @string VARCHAR(200)--increase the variable size depending on your needs. ) RETURNS VARCHAR(200) AS BEGIN --Declare Variables DECLARE @Index INT, @ResultString VARCHAR(200)--result string size should equal to the @string variable size --Initialize the variables SET @Index = 1 SET @ResultString = '' --Run the Loop until END of the string WHILE (@Index 
LEN(@string)) BEGIN --make the letter capital SET @ResultString = @ResultString + UPPER(SUBSTRING(@string,@Index, 1)) SET @Index = @Index +1--increase the index END ELSE-- all others BEGIN -- make the letter simple SET @ResultString = @ResultString + LOWER(SUBSTRING(@string,@Index, 1)) SET @Index = @Index +1--incerase the index END END--END of the loop IF (@@ERROR <> 0)-- any error occur return the sEND string BEGIN SET @ResultString = @string END -- IF no error found return the new string RETURN @ResultString END

转载于:https://www.cnblogs.com/skywss27/p/9926232.html

你可能感兴趣的文章
Java 内存管理、JVM 工作原理与 Java 运行时系统
查看>>
矩阵分解(matrix factorization)
查看>>
大型网站的架构设计与演进
查看>>
二值化函数
查看>>
‘3 sigma’rule(68–95–99.7 rule)
查看>>
内存、时间复杂度、CPU/GPU以及运行时间
查看>>
DES加密解决算法
查看>>
【并发编程】延时初始化
查看>>
编程珠玑--左旋字符串
查看>>
【黑金原创教程】【FPGA那些事儿-驱动篇I 】实验十四:储存模块
查看>>
模板 - 字符串 - Manacher
查看>>
2017.1.2
查看>>
Ice_cream's world I
查看>>
串并行数据结构实验--MAC下SML环境安装1
查看>>
java取整和java四舍五入方法
查看>>
学习linux-基础-操作系统结构
查看>>
卸载Linux内置的AMP软件
查看>>
关于js的几道经典题(作用域、原型链等)自己做的
查看>>
如何判断js是否加载完全
查看>>
【菜鸟学Python】函数的定义及调用
查看>>