Reputation: 4328
I wanted to know the command to find the size of a row in a table in my database. Say I've a database db
and a table table
.
How can i find the size of a row in that database (which includes all the columns)?
Upvotes: 1
Views: 8051
Reputation: 1371
In ASE, I use a combination of sp_estspace and sp_spaceused for total Data / index sizing that I wrote myself. You can grab the source for each inside sybsystemprocs.
sp_estspace tends to overestimate (by a lot) the size of the data (not indexes) and sp_spaceused divided by rowcount tends to not be a good indicator of how big a row could potentially be today (imagine you added 20 nullable columns yesterday and decide to use them, spaceused is unchanged).
It's not perfect by ANY means, but it's been a fairly reliable estimate for my purpose. I wouldn't write any code that would break if it exceeded any of these estimates, though.
Upvotes: 0