다음을 통해 공유


Views Collection

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 말고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

The Views collection contains View objects that reference the view tables defined in a Microsoft SQL Server database.

현재 개체를 보여 주는 SQL-DMO 개체 모델

Properties

Count Property

 

Methods

Add Method

Refresh Method

Item Method

Remove Method (Collections)

ItemByID Method

 

주의

With the Views collection, you can:

  • Create a view table.
  • Remove a view table.

For more information about creating a view table by using the View object and Views collection, see View Object.

To remove a SQL Server view table

  1. Get the View object that references the targeted view table from the Views collection by using the Item or ItemByID method. When extracting a View object using the name of the referenced view table, use the view owner name to qualify, as in:

    Set oView = oDatabase.Views("Invoices", "dbo")
    
  2. Use the Remove method of the View object to remove the targeted view table.

The Item method of the Views collection supports member selection using view name or the ordinal position of the object in the collection. Additionally, when using the name to select an object from the collection, the Item method allows owner name qualification of the targeted SQL Server view. For example:

Set oView = oDatabase.Views("[Current Product List]", "dbo")

The Remove method of the Views collection supports member targeting using either view name or the ordinal position of the object in the collection. The Remove method does not support view owner name qualification when using the method to drop a view. When using the Views collection to remove a SQL Server view table, it is suggested that you use either the Item or ItemByID method of the collection to extract the object referencing the correct view as illustrated earlier.

[!참고] Creating or removing view tables by using the Views collection requires appropriate privilege. The SQL Server login used for SQLServer object connection must be a member of the fixed role db_ddladmin or a role with greater privilege.