C# and SQL LIKE condition: '%' works as single-character wildcard -


i have query in dataset (database located in .mdf file):

select * tablename somefield @param

table tablename contains record Значение in somefield field.

when @param Значени% it's works perfectly, when @param Значен% or Значе%, it's returns 0 rows. Значе%%% works.

why '%' works single-character wildcard?

your problem should using @param of nvarchar, not nchar

declare @param nchar(255) set @param = n'Значе%' 

this really

n'Значе%             ...' (many more spaces) 

so won't match data,

n'Значение             ...' (padded spaces) 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -