declare @help varchar(10)
select @help='p'
select UserID,UserName UserName from tt where like '%'+@help+'%'
ordeclare @help char(10)
select @help='p'
select UserID,UserName UserName from tt where like '%'+rtrim(@help)+'%'
------------------------------------------------------------------------
因为将变量声明为char(10),因此select @help='p'将@help设置为了'p ',后边有九个空格。
select @help='p'
select UserID,UserName UserName from tt where like '%'+@help+'%'
ordeclare @help char(10)
select @help='p'
select UserID,UserName UserName from tt where like '%'+rtrim(@help)+'%'
------------------------------------------------------------------------
因为将变量声明为char(10),因此select @help='p'将@help设置为了'p ',后边有九个空格。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货