create table t(x int identity(1,1) primary key,v nvarchar(32));go insert into t(v) values('this is % line'),('this is 1 line'); 我们的目标是找到'this is % line' 这一行. select x,v from t where v like'%\%%' escape '\'; 第一个'%'用来匹配%前的串. 第二个'%'用来匹配串中的%. 第三个'%'用来匹配%…
sql server replace的替换字符,replace的使用 select REPLACE(name,'张','') * from entity_5c7a578c05c7042958d91485_goods select REPLACE(列名,'匹配的字符',‘想换成的字符’),* from product…
在T-SQL中我们经常批量操作时都会对字符串进行拆分,可是SQL Server中却没有自带Split函数,所以要自己来实现了.这里将字符串分割以table形式输出 语法如下: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* create by shuke.li 2020-9-15 */ create function [dbo].[SplitString] ( @Input nvarchar(max), --input string to…
1.索引查找 select a.name as tabname ,h.name as idname,h.type_descfrom sys.objects as a right join sys.indexes as h on a.object_id=h.object_id where a.type<>'s' order by tabname go 2.外键查找 select a.name as tabname,h.name as idname,h.type_descfrom sys.obje…