IsObjectDeleted Method

SQL-DMO

SQL-DMO

IsObjectDeleted Method

The IsObjectDeleted method indicates whether the referenced object has been deleted from the database.

Applies To
Database2 Object
Syntax

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.

Remarks

If a client session creates an object using SQL-DMO, and another client session subsequently deletes the object using another tool (for example, SQL Query Analyzer), 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.

Note  IsObjectDeleted can be used with Microsoft® SQL Server™ 2000 and SQL Server 7.0.

See Also

IsDeleted Property