sqlsql-serverstoragevarcharmax

SQL Server Text datatype or Varchar(max) creates databases that are too large


When I use SQL Server Text or Varchar(max) datatype in a column it creates databases that are too large : for example 1000 rows in one table containing varchar(max) use around 1000 Mb (1Gb) !!!!

Is that normal ?

thanks for help

Edit my text fields are about 5 to 50 kb MAX


Solution

  • it depends on what's inside your table. If you have 1000 rows with 1mb of data, you will have 1000 Mb

    Try running:

    select datalength(yourField) from yourTable
    

    the datalength function will give you how many bytes are occupied by the column