I have a problem with working at stored procedure and stimulsoft when using Like
operator and and
operator. Please help me. When I use this code, it returns a blank page in stimul, but if I change one of the conditions to or
, the code returns all rows in database table
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[reportedu2]
@d1 NVARCHAR(50),
@d2 NVARCHAR(50),
@name NVARCHAR(50),
@unit NVARCHAR(50),
@semat NVARCHAR(50),
@maghta NVARCHAR(50),
@uni NVARCHAR(50),
@field NVARCHAR(50)
AS
BEGIN
SELECT *
FROM Tbledu
WHERE (unit LIKE '%' + ISNULL(@unit, unit) + '%')
AND (name LIKE '%' + ISNULL(@name, name) + '%')
AND (dateend BETWEEN @d1 AND @d2)
AND (semat LIKE '%' + ISNULL(@semat, semat) + '%')
AND (maghta LIKE '%' + ISNULL(@maghta, maghta) + '%')
AND (uni LIKE '%' + ISNULL(@uni, uni) + '%')
AND (field LIKE '%' + ISNULL(@field, field) + '%')
END