SQLDMO.Database

Klasse som repræsenterer et database objekt.

I SQL Server Books Online er beskrevet hvordan en database oprettes med SQL–DMO objektet „Database“.
Citat:

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.
Note! The Database object is compatible with instances of SQL Server 2000 and SQL Server version 7.0. However, the Database2 object extends the functionality of the Database object for use with features that are new in SQL Server 2000.

Script eksempel på vejledningen fra BOL:

ToDo...

Se også:
SQLDMO.Database2

Niels Grove-Rasmussen Opdateret 30-01-2008 22:58:38.
Ting Ta'r Tid! Hentet 26-09-2018 01:01:35.