Hi
i have created a store procedure that should search employee based on name or/ and surname or AND LOCATION or and business unit.i am able to search to using name,surname and business unit when i add location id it only work for location id. here is my store procedure
ALTER PROCEDURE [dbo].[SearchEmp]
@bu VARCHAR(50) = '',
@firstname VARCHAR(50) = '',
@surname VARCHAR(50) = '',
@location Integer
AS
BEGIN
Select * from vGetEmpContacts
--WHERE Rufna like isnull(@surname +'%',Rufna) AND NickName like isnull(@firstname + '%',NickName)
--AND werks like ISNULL(@bu + '%',werks)
WHERE Rufna like @surname + '%' AND NickName like @firstname + '%'
AND werks like @bu + '%' AND LocID = @location
ORDER BY NickName,Rufna
END