Database Object (SQL-DMO)

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

Remarks

Because it represents a SQL Server database, the Database object is a major component of the 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 allow you to perform essential database maintenance functions, such as backup.

With the Database object, you can:

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 DBFile object properties optional for new database files, such as Size.
  7. Add the DBFile object to the new Database object 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.

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.
Methods
CheckAllocations Method FullTextIndexScript Method
CheckAllocationsDataOnly Method GenerateSQL Method (Database)
CheckCatalog Method GetDatatypeByName Method
CheckIdentityValues Method GetMemoryUsage Method
Checkpoint Method GetObjectByName Method
CheckTables Method Grant Method (Database)
CheckTablesDataOnly Method IsUser Method
Deny Method (Database) IsValidKeyDatatype Method
DisableFullTextCatalogs Method ListDatabasePermissions Method
EnableFullTextCatalogs Method ListObjectPermissions Method
EnumCandidateKeys Method ListObjects Method
EnumDependencies Method RecalcSpaceUsage Method
EnumFileGroups Method Remove Method (Objects)
EnumFiles Method (Database) RemoveFullTextCatalogs Method
EnumLocks Method Revoke Method (Database)
EnumLoginMappings Method Script Method
EnumMatchingSPs Method ScriptTransfer Method
EnumNTGroups Method SetOwner Method
EnumUsers Method Shrink Method
ExecuteImmediate Method (Database, SQLServer) Transfer Method
ExecuteWithResults Method UpdateIndexStatistics Method
ExecuteWithResultsAndMessages Method  

Properties
CompatibilityLevel Property Isdb_securityadmin Property
CreateDate Property IsFullTextEnabled Property
CreateForAttach Property Name Property
DataSpaceUsage Property Owner Property (Database)
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  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.