SQLServer 设置单词首字母大写
时间:2024-01-12 20:14:41
/*
--SQLServer中将字符串首字母设置大写:
--作者:jinjazz /csdn
--SQLServer2005启用OLEAutomation
sp_configure 'show advanced options', 1;
go
RECONFIGURE;
go
sp_configure 'Ole Automation Procedures', 1;
go
RECONFIGURE;
go
*/
use tempdb
go
if (object_id ('fn_toTitleCase' ) is not null )
drop function dbo . fn_toTitleCase
go
create function fn_toTitleCase (@inStr varchar (8000 ))
returns varchar (8000 )
as
begin
declare @str varchar (8000 )
set @str = 'var data = "' +@inStr + '";
var reg = /\b(\w)|\s(\w)/g ;
data = data.toLowerCase();
data.replace(reg,function(m){return m.toUpperCase()});'
declare @object int
declare @r varchar (800 )
exec sp_OACreate 'MSScriptControl.ScriptControl' ,@object output
exec sp_OASetProperty @object , 'Language' , 'javascript'
exec sp_OAMethod @object , 'eval' , @r out , @str
return @r
end
go
select dbo. fn_toTitleCase ('create function fn_toTitleCase(@inStr varchar(8000)) returns varchar(8000)' )
/*输出
Create Function Fn_totitlecase(@Instr Varchar(8000)) Returns Varchar(8000)
*/
标签:单词首字母,大写
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
MySQL 删除数据库中重复数据方法小结
2024-01-25 16:39:03
![](https://img.aspxhome.com/file/2023/8/116758_0s.png)
pandas.dataframe按行索引表达式选取方法
2021-10-28 20:26:32
mysql 获取昨天日期、今天日期、明天日期以及前一个小时和后一个小时的时间
2024-01-24 08:21:54
Javascript typeof 用法
2013-10-20 20:49:40
Tensorflow中的降维函数tf.reduce_*使用总结
2021-10-18 15:16:14
在Django中Pyecharts生成图表实现
2023-07-27 08:16:32
![](https://img.aspxhome.com/file/2023/4/105404_0s.png)
asp vbcrlf是什么意思
2011-03-30 11:03:00
mysql中的int(10)int(20)分别代表什么意思
2024-01-20 21:31:30
10款顶级jQuery插件推荐
2011-08-14 07:55:39
网页在IE6中不能打印之谜
2008-12-12 13:08:00
![](https://img.aspxhome.com/file/UploadPic/200812/12/ie6-error-27s.jpg)
Mysql中报错函数floor()函数和rand()函数的配合使用及原理详解
2024-01-21 13:41:03
![](https://img.aspxhome.com/file/2023/9/128029_0s.png)
利用Python实现模拟登录知乎
2023-09-23 08:32:15
![](https://img.aspxhome.com/file/2023/8/115478_0s.jpg)
影响SQL Server性能的关键三个方面
2009-02-13 16:59:00
SQLServe 重复行删除方法
2024-01-26 18:39:24
Python去除字符串两端空格的方法
2023-06-14 23:15:40
如何使用django的MTV开发模式返回一个网页
2023-07-04 21:47:06
![](https://img.aspxhome.com/file/2023/9/75139_0s.jpg)
Python django搭建layui提交表单,表格,图标的实例
2022-09-18 19:40:19
![](https://img.aspxhome.com/file/2023/6/134856_0s.jpg)
Python 远程开关机的方法
2022-06-19 18:12:30
![](https://img.aspxhome.com/file/2023/6/124416_0s.jpg)
Python进制转换用法详解
2021-08-20 15:18:40
深入解析Go语言编程中的递归使用
2023-10-09 09:24:36