sql server - What does the size of a SQL table depend on? -


i mean sql here can sql database such sql server, sql, sqlite, ms access. want know size of table depends on, depends on actual rows in table fixedly designed structure or depends on content of cells in table. example:

i have table has fixedly designed structure this:

create table sampletable (    id int primary key,    message varchar(500) ) 

and here table 1 row:

id    |     message 1           love .net     --11 characters message 

and here table 1 row:

id    |     message 1           love java     --16 characters message 

if size depends on number of rows, 2 tables above have same size, if depends on cells' content, second table have larger size. know larger? care because, in case, want maximize maximum number of characters field (8000 in sql server), make user free inputing s/he wants, i'm afraid of making database file large (unnecessarily, costly).

your highly appreciated!

a varchar (or nvarchar) field uses space in required.

as such smaller amounts of data take less space. fixed length equivalents (char, nchar) use full length.

the storage size of varchar field actual length of data entered + 2 bytes http://msdn.microsoft.com/en-us/library/ms176089.aspx


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -