次の方法で共有


DBFiles Collection

この機能は、将来のバージョンの Microsoft SQL Server では削除される予定です。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションは修正することを検討してください。

The DBFiles collection contains DBFile objects that expose operating system files used by Microsoft SQL Server for table and index data storage.

現在のオブジェクトを表す SQL-DMO オブジェクト モデル

Properties

Count Property

Methods

Add Method

Refresh Method

Item Method

Remove Method (Collections)

ItemByID Method

 

解説

With the DBFiles collection, you can:

  • Create a new operating system file to contain table or index data.
  • Remove an operating system file from the list of files available for table or index data storage.

The DBFiles collection supports item selection using ordinal position and identifier only. Get the identifier by using the ID property of the DBFile object. When referencing a DBFile object within the collection, refer to it by using its position or its identifier, as in:

Set oDBFile = oDatabase.FileGroups("PRIMARY").DBFiles(1)

Or

Dim     oDBFileID as long

oDBFileID = oDatabase.FileGroups("Northwind_Idx").DBFiles(4).ID

Set oDBFile = _
    oDatabase.FileGroups("Northwind_Idx").DBFiles.ItemByID(oDBFileID)

The DBFiles collection supports removing a database data file by using ordinal position only, as in:

oDatabase.FileGroups("Northwind_Text").DBFiles.Remove(1)
ms131950.note(ja-jp,SQL.90).gifメモ :
Removing an operating system file used to maintain SQL Server database data is constrained by use of the file itself. If any data is currently maintained in the file, the Remove method of the DBFiles collection will fail. Remove and re-create tables, or move table data by creating or re-creating clustered indexes to remove database dependence on a specific operating system file.

Using the DBFiles collection to create or remove operating system files used to maintain SQL Server database data requires appropriate privilege. The SQL Server login used for SQLServer object connection must be a member of one of the fixed roles sysadmin or diskadmin.