Calculating data in the table

  • I need to know how mach space a row takes from the table, how to do it:

    Here is the structure of the table:

    fileld1 varchar(10) Unchecked

    fileld2 varchar(15) Unchecked

    fileld3 varchar(10) Checked

    fileld4 varchar(10) Checked

    fileld5 varchar(10) Checked

    UpdateDate varchar(32) Checked

    UpdatedDate datetime Checked

    InsertedDate datetime Checked

    Data will be like this:

    Example :

    IMROFSG150

    PCHKWSSZ130P

    STYLES

    WSS

    STYPHID06 Thank you

  • You could use the DataLength function on the columns to get how much they are holding. Will that do what you need?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • I am trying to calculate how much space take one row because I will insert 385000 rows, so this is what I have:

    SELECT DATALENGTH(priceschemecode),DATALENGTH(productcode),DATALENGTH(productline),DATALENGTH(productcategory),DATALENGTH(priceclass),DATALENGTH(updatedate),DATALENGTH(updateddate),DATALENGTH(inserteddate)

    FROM dbo.test

    I get this :

    filed1 filed2 filed3 filed4 filed5 filed6 filed7 filed8

    98969NULLNULL8

    Total:41

    Question, so 41 in what? how to calculate 385000 in mags space will be taking Thank you

  • I don't understand your question. The row is 41 bytes wide in that table with that data.

    If you're trying to find out how big the final table will be, your best bet will be to insert something like 1,000 rows of the data, find out how big that is by checking the size of the table, and multiply by 385. That'll get you in the right ballpark.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply