Using variable in SQL LIKE statement
If you are using a Stored Procedure:
ALTER PROCEDURE <Name>( @PartialName VARCHAR(50) = NULL)SELECT Name FROM <table> WHERE Name LIKE '%' + @PartialName + '%'
Joel is it that @SearchLetter hasn't been declared yet? Also the length of @SearchLetter2 isn't long enough for 't%'. Try a varchar of a longer length.
As Andrew Brower says, but adding a trim
ALTER PROCEDURE <Name>( @PartialName VARCHAR(50) = NULL)SELECT Name FROM <table> WHERE Name LIKE '%' + LTRIM(RTRIM(@PartialName)) + '%'