Memoery Allocation For columns Which we Declared in Table Design

  • Morning Everybody,

    I have a doubt regarding the memory allcation in Sql server tables designing..

    Create table test

    (

    id int,

    name varchar(10) --- doubt regarding the data type size

    )

    IN this above situation i declared name varchar(10) for this how the memory allocation in database.. is this is like bit wise or byte wise... Please give me clarification in this

    Thanks in advance

    Skase05

  • Memory-allocation is not as simple as it sounds. Storage per row is easier to explain.

    A varchar takes 2 bytes + the number of bytes stored in it,

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks for ur reply...

    If i am having the column in table with datatype varchar(10) means it will stores the the string with the max length of 10 characters.. If i am storing 'suresh' inside that variable remaining space will be released or it will be alloted as char type allocation...

    Thnaks in advance..

    suresh

  • GilaMonster (7/13/2011)


    A varchar takes 2 bytes + the number of bytes stored in it,

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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