Using NHb 3.2 with Sql Server 2008 I noticed the following problem:

Query like this:

from x in Session.Query<Entity>()
where x.AnsiColumn.StartsWith("00")
select x

is translated into following SQL query:

exec sp_executesql N'select entity0_.Id as Id11_, entity0_.AnsiColumn
as AnsiColumn11 from dbo.Entity entity0_ where entity0_.AnsiColumn
like (@p0+''%'')',N'@p0 nvarchar(4000)',@p0=N'00'

Parametr @p0 is type of nvarchar(4000) but I would expect parmeter of
varchar type.
Conversion from nvarchar to varchar proviedes to performance problem
and non optimal query plans.

How can I avoid such problemes without sacrificing LINQ and AnsiString
columns?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to