IsObjectDeleted Method
未來的 Microsoft SQL Server 版本將移除這項功能。請避免在新的開發工作中使用這項功能,並規劃修改目前使用這項功能的應用程式。
The IsObjectDeleted method indicates whether the referenced object has been deleted from the database.
語法
object.IsObjectDeleted( ObjectType, ObjectName, [ObjectOwner]) as Boolean
Parts
object
Expression that evaluates to an object in the Applies To list.ObjectType
Long integer that indicates the object type as specified in settings.ObjectName
String that specifies the object name.ObjectOwner
Optional string that specifies the object owner.
Prototype (C/C++)
HRESULT IsObjectDeleted)(
SQLDMO_OBJECT_TYPE ObjectType,
SQLDMO_LPCSTR ObjName,
LPBOOL pRetVal,
SQLDMO_LPCSTR ObjOwner);
Settings
Specify the value of the ObjectType argument using these SQLDMO_OBJECT_TYPE values.
Constant |
Value |
Description |
---|---|---|
SQLDMOObj_Check |
49152 |
Object references an integrity constraint. |
SQLDMOObj_Column |
24576 |
Object references a column in a table. |
SQLDMOObj_Database |
135168 |
Object references a database. |
SQLDMOObj_DatabaseRole |
225280 |
Object references a database role. |
SQLDMOObj_Default |
64 |
Object references a default. |
SQLDMOObj_Rule |
128 |
Object references a rule. |
SQLDMOObj_StoredProcedure |
16 |
Object references a stored procedure. |
SQLDMOObj_SystemDatatype |
4096 |
Object references a SQL Server base data type. |
SQLDMOObj_SystemTable |
2 |
Object references a system table. |
SQLDMOObj_Trigger |
256 |
Object references a trigger. |
SQLDMOObj_User |
8192 |
Object references a SQL Server database user. |
SQLDMOObj_UserDefinedDatatype |
4096 |
Object references a SQL Server user-defined data type. |
SQLDMOObj_UserDefinedFunction |
1 |
Object references a user-defined function. |
SQLDMOObj_UserTable |
8 |
Object references a SQL Server user-defined table. |
SQLDMOObj_View |
4 |
Object references a view. |
備註
If a client session creates an object using SQL Distributed Management Objects (SQL-DMO), and another client session subsequently deletes the object using another tool, the SQL-DMO application is unaware of the deletion. A SQL-DMO application can use the IsObjectDeleted method to determine if the object still exists by specifying the object type and object name. If the objectOwner parameter is not used, the application assumes that the object owner is the user currently logged in.
[!附註]
The IsObjectDeleted method can be used with SQL Server 7.0, and Microsoft SQL Server 2000 or later.