I want to write a stored procedure that will accept a parameter of @searchString. This will be a varchar(100) and will contain a query value. How can I write the sp so that it could do something like:
SELECT *
FROM Application a
INNER JOIN Applicant app ON app.ApplicationId = a.ApplicationId
WHERE a.ApplicationId = @searchString
OR app.Name like '@searchString%'
OR app.PostCode like '@searchString%'
The problem for me is how to handle the fact that the searchString may contain an Id which will be an int or could be a string value.