“LIKE %@name%” 解决办法

 

USE master

GO

drop proc myproc
go

//写存储过程
CREATE PROCEDURE myproc

@name VARCHAR(20)
AS

SELECT * FROM sysobjects WHERE xtype LIKE '%'+ @name +'%'


//调用

DECLARE @name VARCHAR(20)

SET @name = 's'

EXEC myproc @name

你可能感兴趣的:(like)