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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining the total size of data in a table row

Status
Not open for further replies.

jalbao

Programmer
Nov 27, 2000
413
US
Does anyone know how to determine how many bits are being used in a table row?

To be more specific: Say i have a table called EmpReports. Each row in the table will contain a employeeID and a memo field that has a bunch of report information. Now I want to run a script that can group all the employeeID's and then determine how many kilobytes each employee is using up in the database.

fyi- this is not a real scenario, but the main idea is there. :)
 
If you're using MS Sql Server, you could do something like this:

select employeeID, len(memoFieldName) as kbSize from ...

I haven't tested it but I think that will do what you want. Just remember that the len() function will return the number of characters and not the actual number of bytes although the number of characters should equal the number of bytes in most cases. I don't think you can ever know how much physical space the database actually uses to store the text but I'm guessing you just need to know the amount of information which the len() function should do for you.

If you're using access though, you could do this query &quot;select employeeID, memoFieldName from ...&quot; and then use <cfloop> to loop through the results and use the CF len() function to calculate the same thing.

Hope this helps,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top