The DBFile object represents the properties of an operating system file used by Microsoft® SQL Server™ for table and index data storage.
SQL Server can direct data storage for tables and indexes to specific operating system files. A single operating system file can contain data from only a single database. Within SQL Server, database data files are categorized by filegroup. A SQL Server database contains one or more filegroups containing one or more data files. This organization is reflected in the FileGroup and DBFile objects and collections.
All SQL Server databases contain a filegroup named PRIMARY. This filegroup contains the database primary data file. When using SQL-DMO to create a new SQL Server database, add a DBFile object to the FileGroup object named PRIMARY. After database creation, additional data files can be created and added to either the PRIMARY filegroup or to filegroups added to the database.
With the DBFile object, you can:
The Name property of a DBFile object uses the SQL Server data type sysname. The Name property value is used for the logical_file_name parameter in the CREATE DATABASE and ALTER DATABASE statements when adding files. The restrictions imposed on the logical_file_name parameter apply to the DBFile Name property.
To create a data file for SQL Server database storage
Remove Method (Objects) | Shrink Method |
ALTER DATABASE | CREATE DATABASE |