parameterized - SubSonic - Generate SQL uses nvarchar instead of varchar which causes Index Scan instead of Seek -


I am using SubSonic SimpleRepository template for my application. I created a SSP .NET Webform project in VS2010, pointing to an SSL 2000 database.

I have a problem where SubSonic is always using nvarchar in parameterized queries instead of varchar. For this reason, SQL scans index instead of an index sequence. I have taken the SQL from the profiler and have changed this to create the parameter worker like the table areas and it executes very quickly (& lt; 1 second vs 8 seconds).

Subsonic query from the profiler <[ADDRESS_L2], [T]. [ADDRESS_L2], [T.]. [ADDRESS_L3], [T.]. [CITY], [T.] [SEPADD] AST 0 WHERE (([T]]. [SITIID] = @ P) and ((([T.]. [ADDRESS_TYPE] = @ P1) and 1 & lt; & gt; 0 OR (([T.]. [ADDRESS_TYPE] = @ P2) and 0 <0)), 'N' P Envernance (16), @ P1 Navarkar (2), @ P2 Navarachar (2) ', @ P = N-BCF 8A A 27E 55EE', @ P1 = N'00 ', @ P2 = N'03' < P> Manually modify queries Or (([T.]. [ADDRESS_TYPE] = @ P2) and 0 <0)) ',' N 'P varchar (16), @ P1V Archar (2), @P 2 varchar (2) ', @ p0 = N'BCF8A0A27E543EE1', @ P1 = N'00 ', @ P2 = N'03'

SITE_ID And ADDRESS_TYPE are varchars . What is a way to force the query to use varchar instead of nvarchar ?

Is there a way to force vargar to use instead of nvarchar ?

You must modify the source code of the sub-indicator to change it.

Comments