Hi Jason - thank you for your reply. I would prefer the casting approach. But how do I do that using the Criteria API ?
Thomas On 10 Jun., 14:27, Jason Meckley <[email protected]> wrote: > one option > select * from MyTable where myIntColumn in (5000, 5010, 5020, 5030, > 5040, 5050, 5060, 5070, 5080, 5090) > if the pattern changes, use code to create the list of valid intergers > and pass this list of valid integers to the query. > > another option > cast MyIntColumn to a varchar and preform a like comparison on the > string value. > > On Jun 10, 8:12 am, Thomas Koch <[email protected]> wrote: > > > > > Hi - In SQL Server 2005 it is possible to do a "LIKE" search against a > > column with an integer type. > > > For instance, if I do: select * from MyTable where MyIntColumn like > > '50_0' > > it will return all the rows where MyIntColumn is 5000, 5010, > > 5020, .... 5090. > > > Now, when I try to do this using the LIKE criteria I get an exception: > > Type mismatch in NHibernate.Criterion.SimpleExpression: MyInt expected > > type System.Int32, actual type System.String > > > My instincts tell me that this is by design, since the ability of SQL > > Server to do a like search against a numeric type is probably SQL > > Server specific. > > > Can anyone tell me if there is a work around for this? > > > Kind regards > > Thomas- Skjul tekst i anførselstegn - > > - Vis tekst i anførselstegn - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
