SQL Server data type and size -


this question has answer here:

i need guidance pertaining sql standards. given task develop small database , manager expects me follow data type , size standards, appropriately use int , big int, if first name use proper data type varchar or char, size not abruptly varchar(60) or varchar(75) use either varchar(128) or varchar(64) or varchar(256). not sure standards. please guide me respect size, how difference makes if declare varchar(60) instead of standard varchar(256). list , starts varchar(8) , ends in varchar(256)

varchar use space length of string (up procided maximum). char used fixed size regardless of size of data stored. there nbo "standards" here guidelines msdn:

  • use char when sizes of column data entries consistent.
  • use varchar when sizes of column data entries vary considerably.
  • use varchar(max) when sizes of column data entries vary considerably, , size might exceed 8,000 bytes.

there not standards regard proper length of varchar. common sense use maximum size data - 256 characters last name seems more reasonable. there's no benefit i'm aware of using multiples of number size since it's stored variable length null terminator.

it sounds organization may have specific standards (use of multiples of 8, etc.) should adhere to, nothing industry-wide i'm aware of.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -