USP_SEARCHLIST_MERCHANDISEDEPARTMENT
Returns a list of active merchandise departments.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@NAME | nvarchar(150) | IN | Name |
@INCLUDEINACTIVE | bit | IN | Include inactive |
@MAXROWS | smallint | IN | Input parameter indicating the maximum number of rows to return. |
Definition
Copy
CREATE procedure dbo.USP_SEARCHLIST_MERCHANDISEDEPARTMENT
(
@NAME nvarchar(150) = null,
@INCLUDEINACTIVE bit = 1,
@MAXROWS smallint = 500
)
as
set @NAME = COALESCE(@NAME,'');
-- Wildcard character support
set @NAME = replace(replace(@NAME,'[','\['),']','\]');
set @NAME = replace(replace(@NAME,'*','%'),'?','_') + '%';
select top(@MAXROWS)
ID,
NAME,
DESCRIPTION
from
dbo.MERCHANDISEDEPARTMENT
where
NAME like @NAME
and
(@INCLUDEINACTIVE = 1 or ISACTIVE = 1)
order by
NAME asc