I have the following select query but its returning everything and not filtering on the where clause:
Code:
declare @Article char(30);
set @Article := 'CLOTHING/FUR';
SELECT
'OFFENSE' AS TblSource,
P_date as entered_date
, CONVERT(CN, CHAR(10)) AS REFNUM
, '' AS UNIQUEKEY
, IF (ISNULL(Pro_Code),'',Pro_Code) AS ARTICLE
, IF (ISNULL(Rec_Loc), '', Rec_Loc) AS DESCRIPT
, IF(ISNULL(serial), '', serial) AS SERNO
, '' AS OAN
, IF(isnull(Model), '', Model) AS MODELNO
, IF(isnull(Brand), '', Brand) AS BRAND
, '' AS ORIGINATINGORG
, now() AS DATECREATED, CONCAT(@Article, '%','')
FROM property
WHERE @Article is null OR UPPER(Pro_Code) LIKE CONCAT(@Article, '%')