Home >Database >Mysql Tutorial >T-SQL常用字符串函数

T-SQL常用字符串函数

WBOY
WBOYOriginal
2016-06-07 14:57:18994browse

T-SQL常用字符串函数 无 ?SELECT SUBSTRING('123456', 2, 3); --'234'SELECT LEFT('123456', 3); --'123'SELECT RIGHT('123456', 3); --'456'SELECT LEN('你好');--2SELECT DATALENGTH('你好');--4SELECT CHARINDEX('23', '1234553');--2SELECT PATINDEX('%[0

T-SQL常用字符串函数
?
SELECT SUBSTRING('123456', 2, 3);       --'234'
SELECT LEFT('123456', 3);               --'123'
SELECT RIGHT('123456', 3);              --'456'
SELECT LEN('你好');						--2
SELECT DATALENGTH('你好');				--4		
SELECT CHARINDEX('23', '1234553');		--2
SELECT PATINDEX('%[0-9]%','abc123gh');	--4
SELECT REPLACE('1-1', '-', '.');		--'1.1'
SELECT REPLICATE('A', 4);				--'AAAA'
SELECT STUFF('ABC', 2, 0, 'abc');		--'AabcBC'
SELECT UPPER('AbCd');					--'ABCD'
SELECT LOWER('AbCd');					--'abcd'
SELECT RTRIM('  abcd  ');				--'  abcd'	
SELECT LTRIM('  abcd  ');				--'abcd  '									
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn