我无法为搜索品牌编写正确的程序,所有产品都出来相关品牌请帮帮我 [英] i cann't write right procedure for search brand and all products comes out related brand please help me
本文介绍了我无法为搜索品牌编写正确的程序,所有产品都出来相关品牌请帮帮我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
create Procedure sp_SearchBrand
@Search varchar(50)
)
AS
DECLARE @count INT
SELECT @count = COUNT(*) FROM [Item Information] WHERE BRND_NM = @Search
BEGIN
IF (@count <> 0)
select distinct (it.PFX_NUM + it.STK_NUM) MFR_SKU_NUM,it.ALT_IMG, it.SLLNG_PNT_1, it.SLLNG_PNT_2, it.LG_ITEM_DSC, it.LIST_AMT, it.BX_PK_UN_CDE, it.SGL_IMG, br.BRND_LOGO, br.BRND_NM from [Item Information] it, BRAND br where br.BRND_ID = it.BRND_NM and it.BRND_NM = @Search
ELSE
select distinct (it.PFX_NUM + it.STK_NUM) MFR_SKU_NUM, it.ALT_IMG,it.SLLNG_PNT_1, it.SLLNG_PNT_2, it.LG_ITEM_DSC, it.LIST_AMT, it.BX_PK_UN_CDE, it.SGL_IMG, br.BRND_LOGO, br.BRND_NM from [Item Information] it, BRAND br where br.BRND_ID = it.BRND_ID AND it.BRND_NM
like '%' + @Search + '%'
END
推荐答案
sp_SearchBrand后缺少括号...
Missing parenthese after "sp_SearchBrand" ...
create Procedure sp_SearchBrand(
@Search varchar(50)
)
AS
DECLARE @count INT
SELECT @count = COUNT(*) FROM [Item Information] WHERE BRND_NM = @Search
BEGIN
IF (@count <> 0)
select distinct (it.PFX_NUM + it.STK_NUM) MFR_SKU_NUM,it.ALT_IMG, it.SLLNG_PNT_1, it.SLLNG_PNT_2, it.LG_ITEM_DSC, it.LIST_AMT, it.BX_PK_UN_CDE, it.SGL_IMG, br.BRND_LOGO, br.BRND_NM from [Item Information] it, BRAND br where br.BRND_ID = it.BRND_NM and it.BRND_NM = @Search
ELSE
select distinct (it.PFX_NUM + it.STK_NUM) MFR_SKU_NUM, it.ALT_IMG,it.SLLNG_PNT_1, it.SLLNG_PNT_2, it.LG_ITEM_DSC, it.LIST_AMT, it.BX_PK_UN_CDE, it.SGL_IMG, br.BRND_LOGO, br.BRND_NM from [Item Information] it, BRAND br where br.BRND_ID = it.BRND_ID AND it.BRND_NM
like '%' + @Search + '%'
END
这篇关于我无法为搜索品牌编写正确的程序,所有产品都出来相关品牌请帮帮我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文