I read the SQL statement and saw that the SQL string that I use is the
same as established by criteria. Then a string of
"Projections.SqlProjection("sum(cast(datalength(object3.Image­) as
bigInt)) total", New String() {"total"}, types))" is wrong, because
there is no object2 in sql generated by the criteria. I think
NHibernate does not handle this string.


On 24 jun, 10:15, Diego Mijelshon <[email protected]> wrote:
> Yeah, sorry, that would be "Imagem" in your case. Of course it's not "Data",
> that was from my proof-of-concept code.
> Just the name of your colum, because you don't control the table alias.
>
>    Diego
>
>
>
> On Thu, Jun 24, 2010 at 09:19, Kminoru <[email protected]> wrote:
> > In place of parameter "Data" i put the alias i want? i tryed with
> > "Data" parameter and i got this exception: "Index was outside the
> > bounds of the array."
> > I got the SQL generated and executed on SQL Server and it´s ok.
> > I tryed with the "imagem.Imagem", being "imagem" my alias and
> > ".Imagem" my property and i got an exception from Database saying in
> > portuguese: "O identificador de várias partes "imagem.Imagem" não pôde
> > ser associado." ("The multi-part identifier" imagem.Imagem "could not
> > be associated with.").
>
> > Thx for answer.
>
> > On 24 jun, 08:56, Kminoru <[email protected]> wrote:
> > > Hey Diego, the string "dl" is alias of some property or just the name
> > > of the column from answer?
>
> > > On 23 jun, 15:50, Diego Mijelshon <[email protected]> wrote:
>
> > > > .SetProjection(
> > > >                Projections.SqlProjection("sum(datalength(Data)) dl",
>
> > > >                                          new[] {"dl"},
>
> > > >                                          new[] {NHibernateUtil.Int64}))
>
> > > >    Diego
>
> > > > On Wed, Jun 23, 2010 at 14:54, Kminoru <[email protected]> wrote:
> > > > > i did
> > > > > this:
>
> > .SetProjection(Projections.Alias(Projections.SqlProjection("sum(cast(datale­­­ngth(imagem.Imagem)
> > > > > as bigInt))", New String() {"imagem.Imagem"}, types), "total")) and
> > > > > got this exception mensage:"O identificador de várias partes
> > > > > "imagem.Imagem" não pôde ser associado."
>
> > > > > Translated by google: "The handle multi-part "imagem.Imagem" could
> > not
> > > > > be associated"
> > > > >  What´s wrong?
>
> > > > > On 23 jun, 11:21, Diego Mijelshon <[email protected]> wrote:
> > > > > > You can use Projections.SqlProjection or .SqlGroupProjection to
> > access
> > > > > > arbitrary functions.
>
> > > > > >    Diego
>
> > > > > > On Wed, Jun 23, 2010 at 09:37, Kminoru <[email protected]>
> > wrote:
> > > > > > > Hello, in my application, i need select de sum of length of some
> > > > > > > objects. These objects are varbinary type. I found that SQL
> > SERVER has
> > > > > > > the function datalength that return it. How can i do this using
> > > > > > > criteria?
> > > > > > > Thanks for all.
>
> > > > > > > --
> > > > > > > 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]­>
> > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup­s.com>
> > ­­>
> > > > > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup­s.com>
> > <nhusers%252bunsubscr...@googlegroup­­s.com>
> > > > > ­>
> > > > > > > .
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/nhusers?hl=en.-Ocultartextodas
> > > > > mensagens anteriores -
>
> > > > > > - Mostrar texto das mensagens anteriores -
>
> > > > > --
> > > > > 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]­>
> > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup­s.com>
> > ­­>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/nhusers?hl=en.-Ocultartexto das
> > mensagens anteriores -
>
> > > > - Mostrar texto das mensagens anteriores -- Ocultar texto das mensagens
> > anteriores -
>
> > > - Mostrar texto das mensagens anteriores -
>
> > --
> > 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.- Ocultar texto das mensagens 
> >anteriores -
>
> - Mostrar texto das mensagens anteriores -

-- 
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