0
我使用NopCommerce 3.5,我試圖修改SQL存儲過程是能夠搜索SKUSQL凡與子句包含
我的問題是如何得到下面的SQL還檢查列值也包含在關鍵字中?
--SKU
IF @SearchSku = 1
BEGIN
SET @sql = @sql + '
UNION
SELECT p.Id
FROM Product p with (NOLOCK)
WHERE '
IF @UseFullTextSearch = 1
SET @sql = @sql + '(CONTAINS(p.[Sku], @Keywords) OR CONTAINS(@Keywords, p.[Sku])) '
ELSE
SET @sql = @sql + '(PATINDEX(@Keywords, p.[Sku]) > 0 OR PATINDEX(p.[Sku], @Keywords) > 0) '
END
嘗試用通配符包裝p.sku。例如'patindex('%'+ p。[sku] +'%',@ keywords' – Xedni
That worked !! :)謝謝! – Orion