qds.spDeleteAttribute
Description
Recursively deletes an attribute and all its descendants from the QDS schema, removing associated links, tolerances, and data sources.Parameters
- `@attributeId` (int): The ID of the root attribute to delete.Key Operations
- Builds a recursive list of attributes to delete using a CTE - Deletes associated records from: - `qds.chkItemAttrLink` - `qds.attributeDataSource` - `qds.attributeTolerance` - Nulls out parentId references for attributes being deleted - Deletes the attributes themselvesReturn Value
Returns the total number of rows deleted from all affected tables.Example
-- Delete an attribute and its children recursively
DECLARE @deletedRows INT;
EXEC @deletedRows = qds.spDeleteAttribute @attributeId = 103;
SELECT @deletedRows AS DeletedRows;