日期:2014-05-17  浏览次数:20652 次

mssql变量代换
存储过程里面
select * from dd where aa like '%@a%'

@a 这个是一个变量  怎么代换
mssql变量代换 MS?SQL 存储 select

------解决方案--------------------

declare @a varchar(100)

select @a='[搜索值]'

select * from dd where aa like '%'+@a+'%'

------解决方案--------------------
DECLARE @a VARCHAR(100)
SET @a = 'test'
select * from dd where aa like '%'+@a+'%'

------解决方案--------------------
DECLARE @a VARCHAR(100)
select * from dd where aa like '%'+ISNULL(@a, '')+'%'