You are searching for records which contain the string
"@fullname"
. If you want to search for records which contain the value of the
@fullname
parameter, you need to concatenate it into the search term:
CREATE OR ALTER PROCEDURE dbo.SelectFullName
(
@fullname nvarchar(16)
)
As
BEGIN
DECLARE @query nvarchar(20);
SET NOCOUNT ON;
SET @query = N'"*' + @fullname + N'*"';
SELECT
*
FROM
dbo.NamePersonTB
WHERE
CONTAINS (fullname, @query)
;
END