CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: DB size

  1. #1
    Join Date
    Jul 2002
    Posts
    146

    DB size

    Hi all,
    I have designed a table with a column of varchar(50).
    I fill 1000 rows with one char.

    Wich is the table asize ?
    50*1000 = 50000 bytes
    or
    1*1000 = 1000 bytes


    Many thanks

  2. #2
    Join Date
    Feb 2005
    Location
    Denmark
    Posts
    742

    Re: DB size

    If you use SQL Server, look at the properties for your table and/or your database and view the storage value.

    According to MSDN the storage size is the actual length of data entered + 2 bytes (for SQL Server) for a varchar datatype
    Last edited by Alsvha; August 31st, 2009 at 09:17 AM.

  3. #3
    Join Date
    Jun 2006
    Posts
    437

    Re: DB size

    Hi all.

    You didn't say what db you're using. If it's Oracle, the fields VARCHAR(n) will be filled with blanks, so the table size will be 50000 bytes. Use instead VARCHAR2(n), the field won't be filled so the size will become 1000 bytes.

  4. #4
    Join Date
    Jul 2002
    Posts
    146

    Re: DB size

    it is a sql server 2005 db

  5. #5
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: DB size

    You can use Execute sp_spaceused TABLENAME to get these details in SQL.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured