1

I want to call COUNT_BIG function over my table. This table returns a lot of data (bigint). I'm finding a way how can I call this function from EF. Until now I have a following code:

var qStr = @"SELECT COUNT_BIG() FROM Attachment"; 
var attachmentCountQuery = context.CreateQuery<long>(qStr);

But I don't know how to get the long variable from this query?

Or is there exists another way how to get the total count of the records from table, where count is bigint?

thanks

1 Answer 1

1

Seeing here you are missing some code on that select.

You need to specify which field (expression) to count.

Something like:

var qStr = @"SELECT COUNT_BIG(column_from_Attachment_table) FROM Attachment"; 
var attachmentCountQuery = context.CreateQuery<long>(qStr);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.