다음을 통해 공유


Database Object

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

The Database object represents the properties of a single instance of Microsoft SQL Server.

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

Properties

CompatibilityLevel Property (Database)

Isdb_securityadmin Property

CreateDate Property

IsFullTextEnabled Property

CreateForAttach Property

Name Property

DataSpaceUsage Property

Owner Property (Database, UserDefinedFunction)

DboLogin Property

Permissions Property

ID Property

PrimaryFilePath Property

IndexSpaceUsage Property

Size Property

Isdb_accessadmin Property

SpaceAvailable Property

Isdb_backupoperator Property

SpaceAvailableInMB Property

Isdb_datareader Property

Status Property (Database)

Isdb_datawriter Property

SystemObject Property

Isdb_ddladmin Property

UserName Property

Isdb_denydatareader Property

UserProfile Property

Isdb_denydatawriter Property

Version Property

Isdb_owner Property

 

Methods

CheckAllocations Method

ExecuteWithResultsAndMessages Method

CheckAllocationsDataOnly Method

FullTextIndexScript Method

CheckCatalog Method

GenerateSQL Method (Database)

CheckIdentityValues Method

GetDatatypeByName Method

Checkpoint Method

GetMemoryUsage Method

CheckTables Method

GetObjectByName Method

CheckTablesDataOnly Method

Grant Method (Database)

Deny Method (Database)

IsUser Method

DisableFullTextCatalogs Method

IsValidKeyDatatype Method

EnableFullTextCatalogs Method

ListDatabasePermissions Method

EnumCandidateKeys Method

ListObjectPermissions Method

EnumDependencies Method

ListObjects Method

EnumFileGroups Method

RecalcSpaceUsage Method

EnumFiles Method (Database)

Remove Method (Objects)

EnumLocks Method

RemoveFullTextCatalogs Method

EnumLoginMappings Method

Revoke Method (Database)

EnumMatchingSPs Method

Script Method

EnumNTGroups Method

ScriptTransfer Method

EnumUsers Method

SetOwner Method

ExecuteImmediate Method (Database, SQLServer)

Transfer Method

ExecuteWithResults Method

UpdateIndexStatistics Method

주의

Because it represents a SQL Server database, the Database object is a major component of the SQL Distributed Management Objects (SQL-DMO) object tree. The Database object contains collections that define the tables, stored procedures, data types, and users of a database. Methods of the Database object enable you to perform essential database maintenance functions, such as backup.

With the Database object, you can:

  • Create a SQL Server database.
  • Add database roles, rules, stored procedures, tables, user-defined data types, users, and views to an existing SQL Server database.
  • Remove or drop database objects (tables, views, and so on) from an existing SQL Server database.
  • Modify the disk resource used by the database for storage.
  • Back up or restore an existing SQL Server database or its transaction log.
  • Control SQL Server database security by adding users and granting, denying, or revoking access rights to the database.
  • Check SQL Server database integrity.
  • Check current usage in the database; specifically, check the status of locks applied against database resources.

The Name property of a Database object is a character string. Name must be a valid string for the SQL Server sysname data type.

To create a SQL Server database

  1. Create a Database object.

  2. Set the Name property of the Database object.

  3. Create a DBFile object.

  4. Set the Name property of the DBFile object.

  5. Set the PhysicalName property of the DBFile object.

  6. Set the DBFile object properties that are optional for new database files, such as Size.

  7. Add the DBFile object to the new FileGroup object named PRIMARY.

  8. Add the Database object to the Databases collection of a connected SQLServer object.

If you do not set the Size property of the DBFile object or specify a transaction log file, SQL Server defaults are used. For more information, see CREATE DATABASE(Transact-SQL).

You can specify a transaction log file during SQL Server database creation. Specify the log file prior to adding the Database object to the Databases collection.

To specify a log file

  1. Create a LogFile object.

  2. Set the Name property.

  3. Set the PhysicalName property.

  4. Set the LogFile Size property.

  5. Add the LogFile object to the LogFiles collection of the TransactionLog object of the new Database object.

[!참고] The Database object is compatible with instances of SQL Server version 7.0 and later. However, the Database2 object extends the functionality of the Database object for use with features that were introduced in SQL Server 2000.

참고 항목

참조

Database2 Object

도움말 및 정보

SQL Server 2005 지원 받기