Partager via


DatabaseName Property

Cette fonctionnalité sera supprimée dans une prochaine version de Microsoft SQL Server. Évitez d'utiliser cette fonctionnalité dans de nouveaux travaux de développement, et prévoyez de modifier les applications qui utilisent actuellement cette fonctionnalité.

The DatabaseName property represents the name of an existing Microsoft SQL Server database. It constrains SQL Server Agent service alerts or directs execution of SQL Server Agent job steps.

Syntaxe

object
.DatabaseName [= value]

Parts

  • object
    An expression that evaluates to an object in the Applies To list
  • value
    Specifies an existing SQL Server database by name

Data Type

String

Modifiable

Read/write. When the property is set for an Alert or JobStep object, the value must reference an existing SQL Server database.

Prototype (C/C++)

HRESULT GetDatabaseName(SQLDMO_LPBSTR pRetVal);
HRESULT SetDatabaseName(SQLDMO_LPCSTR NewVal);
ms131500.note(fr-fr,SQL.90).gifRemarque :
SQL Distributed Management Objects (SQL-DMO) strings are always returned as OLE BSTR objects. A C/C++ application obtains a reference to the string. The application must release the reference using SysFreeString.

Notes

SQL Server Agent alerts can be fired when a specified system message is generated by an action occurring on an instance of SQL Server. Alerts based on messages can be constrained so the alert is only fired when the action occurs within a single database. For example, system message 1105 is generated if a database is full and can accept no more rows. An Alert object representing this alert for the Northwind database has a MessageID property value of 1105 and a DatabaseName property value of Northwind.

Each step of a SQL Server Agent job can execute in a specified database. Setting the DatabaseName property of a JobStep object directs the execution of the represented step.

Applies To:

Alert Object

JobStep Object