Print Page | Close Window

COUNT_BIG in PassThruESQL doesn't work

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1417
Printed Date: 22-Sep-2025 at 2:53am


Topic: COUNT_BIG in PassThruESQL doesn't work
Posted By: pk55
Subject: COUNT_BIG in PassThruESQL doesn't work
Date 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)
 



Replies:
Posted By: kimj
Date 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.
http://msdn.microsoft.com/en-us/library/bb738514.aspx -
 
http://msdn.microsoft.com/en-us/library/bb738514.aspx
http://msdn.microsoft.com/en-us/library/bb399163.aspx - http://msdn.microsoft.com/en-us/library/bb399163.aspx
 
 
 


Posted By: pk55
Date 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.



Print Page | Close Window