Skip to main content

mes.spDeleteSingleAssetWithNoHistory

Description

Deletes a single asset and its associated metadata if it has no historical data and no descendant assets. If history exists, raises an error instructing to use spAdminDeleteAsset. If descendants exist, instructs to use spDeleteMultipleAssetsWithNoHistory.

Syntax

mes.spDeleteSingleAssetWithNoHistory @assetId

Parameters:
@assetId (int): The ID of the asset to be deleted. Must not have child assets or historical records.

Returns:
int: Total number of rows deleted or updated.
Raises error: If historical data exists or more than one asset is detected in the deletion scope.

Code Example

-- Delete single asset if it has no children and no historical data
EXEC mes.spDeleteSingleAssetWithNoHistory @assetId = 3061;