u r laughing ha , ok here is my case, am not using direct select, am executing a string but am having the following error:
An expression of non-boolean type specified in a context where a condition is expected, near 'Reques'.
here is the query :
ALTER procedure [dbo].[GetFilteredRequests]
set nocount on
DECLARE @strSql nvarchar(500)
SET @strSql = '
select Requests.ReqNo, Requests.Title, Products.Name, Requests.CreateDate, datediff(day, Requests.UpdateDate, getdate()) as LastUpdAge,
datediff(day, Requests.CreateDate, getdate()) as Age, datediff(day, Requests.CreateDate, Requests.UpdateDate) as WorkAge, Status.Description
from Requests inner join products on Requests.product = products.id
inner join status on Requests.status = status.id
where (Requests.Product in (' + @Product + ') or Requests.Product is null) and (Requests.Status in (' + @Status + ') or Requests.Status is null)'