要查找某个指定的字符在字符串中出现的位置,方法比较简单,使用 len() 函数和 replace() 函数结合就可以. SELECT TOP 200 approveInfo approveInfo2, LEN(approveInfo)-LEN(REPLACE(approveInfo,';','')) AS appLen, * FROM dbo.Log_Year WHERE ISNULL(approveInfo,'')<>'' ORDER BY appLen DESC 原理:字符串的长度 减去…
sql 解析字符串添加到临时表中 sql存储过程in 参数输入 解决方法 把字符串解析 添加到 临时表中 SELECT * into #临时表 FROM dbo.Func_SplitOneColumnTabel('001,gf', ',') select * from 表 where ID in (select id from 临时表) Create function [dbo].[Func_SplitOneColumnTabel] (@str nvarchar(max),@split v…
sql server 查找包含字符串的对象 SELECT sm.object_id, OBJECT_NAME(sm.object_id) AS object_name, o.type, o.type_desc, sm.definition FROM sys.sql_modules AS sm JOIN sys.objects AS o ON sm.object_id = o.object_id where sm.definition like '%要匹配的内容%' --collate SQL_L…
<script type="text/javascript"> //查找字符串中出现最多的字符和出现的次数 var str = 'Thatwheneying its on security.'; function find(str) { var max = 0, c; while(str) { var char = str.charAt(0); var a = str.split(char); var count = str.length - (str = a.join(&…