mes.spDeleteMultipleAssetsWithNoHistory
Description
Deletes an asset and all of its descendants as long as no historical data (state events, counters, mode events, checklist events) is found. Raises an error if historical data is detected, and instructs to use spAdminDeleteAssetWithHistory instead.Syntax
mes.spDeleteMultipleAssetsWithNoHistory @assetIdParameters:
@assetId (int): Root asset ID for deletion. All descendants will be evaluated.
Returns:
int: Total number of rows deleted or updated.
Raises error: If historical data exists for any asset in the hierarchy.
Code Example
-- Delete asset and all children if no history exists
EXEC mes.spDeleteMultipleAssetsWithNoHistory @assetId = 3005;