charindex wrong result Charindex returns no record if only one letter is provided.
If parameter matches the whole word it shows the record.
Why???

USE [database]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[filter_opombe] 
@opombe_par nchar(256)
AS
BEGIN    
    SELECT Id_opombe
    FROM opombe
    WHERE (CHARINDEX(@opomba_par, opomba,0) &gt; 0)
END


Thanks for all your replies in advance.
You must declare it as (n)varchar(x) if you need a variable length string:

ALTER PROCEDURE [dbo].[filter_opombe] 
(   
@opombe_par nvarchar(256)
)
AS
BEGIN
(
SELECT        Id_opombe
FROM            opombe
WHERE        (CHARINDEX(@opomba_par, opomba,0) &gt; 0)
)
END


With a (n)char data type, shorter string will be stuffed with white space at the end: 'x' with data type nchar(5), becomes 'x    '.