In Transact-SQL (T-SQL) the SIZE option appears in file specifications for CREATE DATABASE and ALTER DATABASE statements. It pre-allocates the physical space (in KB, MB, GB, or TB) that the data or log file will occupy on disk. By explicitly setting SIZE, administrators can avoid frequent autogrowth events, improve performance, and ensure enough space is reserved for expected data volume. If no unit is supplied, SQL Server interprets the number in 8-KB pages (effectively kilobytes). SIZE cannot be smaller than the minimum required for the file type, and it must not exceed the available disk capacity or the MAXSIZE value (if specified).
SIZE
(integer) - Numeric value followed optionally by KB, MB, GB, or TB that sets the initial file size.Units
- Optional suffix; if omitted the number is treated as kilobytes (8-KB pages).FILEGROWTH, MAXSIZE, CREATE DATABASE, ALTER DATABASE, Autogrowth, Files and Filegroups
SQL Server 7.0
SQL Server assigns default sizes (8 MB data, 1 MB log) and then relies on FILEGROWTH to expand the files.
Yes. The operating system allocates the specified amount of space as soon as the command executes.
No. SIZE must be less than or equal to MAXSIZE; otherwise SQL Server returns error 5134.
Use ALTER DATABASE database_name MODIFY FILE (NAME = logical_name, SIZE = new_size );