New Posts New Posts RSS Feed: COUNT_BIG in PassThruESQL doesn't work
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

COUNT_BIG in PassThruESQL doesn't work

 Post Reply Post Reply
Author
pk55 View Drop Down
Senior Member
Senior Member


Joined: 22-Jul-2009
Location: CA
Posts: 105
Post Options Post Options   Quote pk55 Quote  Post ReplyReply Direct Link To This Post Topic: COUNT_BIG in PassThruESQL doesn't work
    Posted: 07-Aug-2009 at 4:06pm

I'm trying to use a PassThruESQLQuery that does a COUNT_BIG on an entity.  COUNT_BIG is being used since it returns a BIGINT, instead of COUNT, which returns just an INT. 

SELECT VALUE COUNT_BIG(u.ObjectID) FROM MyEntitySet AS u
 
The same query will work if I use COUNT but not with COUNT_BIG (which is supposed to be supported in Entity Framework).  It just throws the error below. 
 
I'm not sure if this is a DevForce problem or Entity Framework problem.  I'm using the official Silverlight 3 and DevForce Silverlight releases.
 
Any thoughts?
 
IdeaBlade.EntityModel.Server.EntityServerErrorHandler:CreateMessageFault">Caught exception:
System.Data.EntitySqlException: 'COUNT_BIG' cannot be resolved into a valid type constructor or function., near function, method or type constructor, line 1, column 23.
   at System.Data.Common.EntitySql.SemanticResolver.ResolveNameAsStaticMethodOrFunction(MethodExpr methodExpr, TypeUsage& constructorType, TypeUsage& staticMethodType, IList`1& functionType)
   at System.Data.Common.EntitySql.SemanticAnalyzer.ConvertStaticMethodOrFunction(MethodExpr methodExpr, SemanticResolver sr)
   at System.Data.Common.EntitySql.SemanticAnalyzer.ConvertMethodExpr(Expr expr, SemanticResolver sr)
   at System.Data.Common.EntitySql.SemanticAnalyzer.Convert(Expr astExpr, SemanticResolver sr)
   at System.Data.Common.EntitySql.SemanticAnalyzer.ProcessGroupByClause(DbExpressionBinding source, QueryExpr queryExpr, SemanticResolver sr)
   at System.Data.Common.EntitySql.SemanticAnalyzer.ConvertQuery(Expr expr, SemanticResolver sr)
   at System.Data.Common.EntitySql.SemanticAnalyzer.Convert(Expr astExpr, SemanticResolver sr)
   at System.Data.Common.EntitySql.SemanticAnalyzer.ConvertRootExpression(Expr astExpr, SemanticResolver sr)
   at System.Data.Common.EntitySql.SemanticAnalyzer.Analyze(Expr astExpr, DbCommandTree commandTree)
   at System.Data.Common.EntitySql.CqlQuery.AnalyzeSemantics(DbCommandTree builderTree, Expr astExpr, Perspective perspective, ParserOptions parserOptions, Dictionary`2 parameters, Dictionary`2 variables)
   at System.Data.Common.EntitySql.CqlQuery.Compile(DbCommandTree builderTree, String queryText, Perspective perspective, ParserOptions parserOptions, Dictionary`2 parameters, Dictionary`2 variables)
   at System.Data.Objects.EntitySqlQueryState.Parse(DbCommandTree parseTree)
   at System.Data.Objects.EntitySqlQueryState.GetResultType()
   at System.Data.Objects.Internal.ObjectQueryState.get_ResultType()
   at System.Data.Objects.ObjectQuery.GetResultType()
   at lambda_method(ExecutionScope , Object , Object[] )
   at IdeaBlade.Core.MemberInfoFns.FastMethodInvoke(Object instance, MethodInfo method, Object[] args)
   at IdeaBlade.EntityModel.Edm.EdmQueryExecutor.GetResultTypeUsage(IQueryable objectQuery)
   at IdeaBlade.EntityModel.Edm.PassthruEsqlQueryExecutor.ExecuteQuery(PassthruEsqlQuery query)
   at IdeaBlade.EntityModel.Edm.PassthruEsqlQueryExecutor.ExecuteCore(IEntityQuery query, IDataSourceKey edmKey)
   at IdeaBlade.EntityModel.Edm.PassthruEsqlQueryExecutor.Execute(IEntityQuery query, IDataSourceKey edmKey)
   at IdeaBlade.EntityModel.Server.EntityServer.Fetch(IEntityQuery query, IDataSourceKey dsKey)
   at IdeaBlade.EntityModel.Server.EntityServer.Fetch(SessionBundle sessionBundle, IEntityQuerySurrogate surrogate)
   at SyncInvokeFetch(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 07-Aug-2009 at 5:27pm
I find the Entity SQL documentation a little unclear.  You should use BigCount()  for a non-database vendor specific implementation, or if using SQL Server, then SqlServer.Count_Big() will work.
 
 
 
 
Back to Top
pk55 View Drop Down
Senior Member
Senior Member


Joined: 22-Jul-2009
Location: CA
Posts: 105
Post Options Post Options   Quote pk55 Quote  Post ReplyReply Direct Link To This Post Posted: 07-Aug-2009 at 9:23pm

Yeah, I saw that too (I'm using Sql Server 2008) but didn't realize you actually need "SqlServer.COUNT_BIG" and not just "COUNT_BIG".  That fixed it.

Thanks Kim.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down