Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Space used in table

Status
Not open for further replies.

thegarrett

IS-IT--Management
Feb 11, 2002
9
GB
Good morning everyone!

I have a very simple query.

I am trying to find out how much space each row is using in a table. I have tried using sp_spaceused and sp_msforeachtable stored procedures, but just cant quite get what I am after. Basically if I do a select * from tablename I get a list of everything I need except the Row space.

As you might have guessed I am no guru in SQL.

Hope you can help

thegarrett
 
Do you want the actual size in bytes of the data or the total size including 'red tape' for each row on the data page?

If you just want the data size you could do the following.
I have a table called firstone with three columns col1, col2 and col3

select col1, col2, col3, 'length of data'=datalength(col1)+ datalength(col2) + datalength(col3) from firstone

This returns
col1 col2 col3 length of data
---------- ----------- -------------------- --------------
abcdefghij 1 hello 19
abcdefghij 2 there! 20
abcdefghij 3 different 23
abcdefghij 4 lengths of data 29

(4 row(s) affected)
 
Thanks jester777,

I Have tried this but not quite what I am after.

I have a table called ole_items and in this table are imported scanned images. The table is currently 1.9gb but the file sizes that are being imported are only a couple of kb. I think that the front end program isnt importing the files correctly, so i need to find out how much space each file is using in the table.

Many thanks

thgarrett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top