字符串函数

来源:互联网 发布:没有安卓 知乎 编辑:程序博客网 时间:2024/05/17 18:40
--返回ascii值select ASCII('a')select char(97)--输出5个空格select SPACE(5)--patindex 匹配select patindex('%张%','张氏寻祖')--charindex 不支持通配符select SUBSTRING(ContactName,CHARINDEX('',contactname)+1) from customers--数字转string类型print str(-31.31)--replace替换函数print replace ('1234','2','a')--stuff 删除字符串,并替换                                    select STUFF('abc',2,1,'1')--replicate select replicate('avrec',3)--reverse 反转字符串select reverse('abc123')--left  返回从左边起第几个字select left('abc',2)--right select RIGHT('qwe',2)--ltrim rtrim 去除空格--lower 小写 print lower('AcrqSDqw')--upper 大写print upper('AcrqSDqw')

0 0
原创粉丝点击