Skip to content

NH-2466 - Like operator doesn't work over fixed length columns (CHAR) SQL server #1224

Open
@nhibernate-bot

Description

@nhibernate-bot

Jesus Otero created an issue — 20th December 2010, 14:34:16:

Like Restrictions over char columns for SQL 2005 (other versions probably the same) the query returns no results. I opened a SQL Profile and see the query generated:

SELECT count(*) as y0_ FROM RM00101 this_ WHERE this_.CUSTNAME like @p1;
',N'@p0 int,@p1 char(8000)',@p0=20,@p1='A% <...>'

Clearly the issue is due SQL fetch the fixed length column with spaces.

Changing the query above to the one below will fix the issue:

SELECT count(*) as y0_ FROM RM00101 this_ WHERE this_.CUSTNAME like @p1;
',N'@p0 int,@p1 varchar(8000)',@p0=20,@p1='A%'

Fabio Maulo added a comment — 21st December 2010, 4:41:39:

NH create queries depending on mappings/parameterSetting-on-query
We don't know neither you mappings nor the code to run the query.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions