all groups > sql server programming > december 2005 >
You're in the

sql server programming

group:

size of the resultset



RE: size of the resultset LightMiner
12/5/2005 4:22:02 PM
sql server programming:
The only thing I can think of is dump it into a table and then figure it out
from there. Even a temp table or something.

Also - don't forget you can calculate sizes yourself. For varchar take the
average length of it plus the overhead to get its size. So it would be:

4*#ofIntColumns*rows + 2*#ofsmallintColumns *rows etc for all the types...
If you build this up in completely dynamic sql and parameterize the table
name then you can re-use it later


You could potentially change your query into a 'prequery' where it is all
counts instead of returning the actual data. select count(this),
count(that), etc. Then use the storage amount per data type to calculate the
total storage without every materializing the result set until you know the
result. I don't know off the top of my head if nulls require storage, in
MSAS I know they don't, but in SQL Server they might. If they don't, you
could update the result set subtracting the null rowcount from the previous
result.

Lots of options! Depends how accurate you need to be, and if you want to
use this before actually completing the query...


[quoted text, click to view]
size of the resultset prefect
12/5/2005 11:25:45 PM
is there a way to determine the size of the resultset
returned from a query in bytes?

thanks

AddThis Social Bookmark Button