早教吧 育儿知识 作业答案 考试题库 百科 知识分享

编写存储过程时,like语句如何用CREATEPROCEDUREGetByListName@araecodevarchar(50)ASselectAREACODE,AREANAME,AREAFULLNAMEfromareawhere(AREACODElike'@areacode%'orPARENTCODElike'@areacode%')andISUSING='1‘GO

题目详情
编写存储过程时,like语句如何用
CREATE PROCEDURE GetByListName @araecode varchar(50)
AS
select AREA_CODE,AREA_NAME,AREA_FULLNAME from area where (AREA_CODE like '@area_code%'or PARENTCODE like '@area_code%') and IS_USING='1‘
GO
▼优质解答
答案和解析
CREATE PROCEDURE GetByListName @araecode varchar(50)
AS
select AREA_CODE,AREA_NAME,AREA_FULLNAME from area where (AREA_CODE like '%'+@area_code+'%' or PARENTCODE like '%'+@area_code+'%') and IS_USING='1‘
GO