# mes.spDeleteAsset

## Description
Deletes a single asset and its associated metadata. Also deletes historical records such as state events, counters, and mode events. If child assets exist, they will be recursively deleted as well.

## Syntax
<b>mes.spDeleteAsset @assetId</b>  
<br /><br />

<b>Parameters:</b><br />
@assetId (int): The ID of the asset to delete, along with all of its descendants and associated records.<br /><br />

<b>Returns:</b><br />
int: Total number of rows deleted or updated.

### Code Example

```sql
-- Delete asset and its history
EXEC mes.spDeleteAsset @assetId = 3099;
