Thanks so Much Diego! You Rock Unfortunately, that did not work for me as I am using this code https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/branches/2.1.x/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs not the one that is in the trunk :( (figured that out when it barked at me for no function locate exists) I will change it to the trunk tomorrow and let you know how it goes.
2 Questions: trunk is current dev right? Do you have a site or a book that you can direct me to so that I do not have to ask silly questions like this one again? Thanks again for your help! On Jul 12, 8:33 pm, Diego Mijelshon <[email protected]> wrote: > You were almost there... you are missing the searched for char: > > Restrictions.Gt( > Projections.SqlFunction("locate", > NHibernateUtil.Int32, > Projections.Constant(theChar), > Projections.Property("Name")), > 0) > > Diego > > > > On Mon, Jul 12, 2010 at 20:34, thecodefool <[email protected]> wrote: > > I am trying to use the CHARINDEX function in SQL Server 2008 in a > > query, the query in SQL Server would look like this > > (I know don't use *, just for brevity ) > > > DECLARE @p0 varchar(50); > > SET @p0='Joe'; > > SELECT * FROM MyTable WHERE @p0='' OR CHARINDEX(@p0,Name)>0 > > > That of course would show me everything if @p0='' or it would show me > > all the rows that contained 'Joe' in the field "Name" > > > I have figured out (I think) that CHARINDEX is locate from the src > > (search for "charindex") > > >https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibe... > > > So I assume I should do this: > > > var criteria = > > Session.CreateCriteria(typeof(MyTable)).SetMaxResults(10).Add( > > // Charindex is locate > > Restrictions.Gt( > > Projections.SqlFunction("locate", > > NHibernateUtil.Int32, Projections.Property("Name")),0)); > > > I have been Googling for quite a while now, Can anyone solve or point > > me in the right direction? > > > Thanks > > > -- > > 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]<nhusers%[email protected] > > > > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. -- 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.
