Delete: delete

Use delete to delete all objects that satisfy the WHERE clause. The syntax of the where clause is identical to select, update or delete, and is fully described in the select command section. A check-in change package is created that records the set of items that were deleted. The items are deleted in a server transaction. As a result, either all items are deleted (and the transaction succeeds) or not a single item is deleted and the transaction fails. If the transaction fails, it is rolled back. Values that contain spaces should be enclosed in double quotes. This command has been modeled on the standard SQL DELETE syntax.

Syntax

The syntax for this command is:

stcmd{Ex} delete  type {local} {output* | {propertyName,...} | 
filter='myFilter' into "outputFilePath" {separator 'fieldSeparator'}}
where {{ attached-label = 'labelName' } | { query = 'myquery' } | 
propertyName relation value and/or propertyName relation value and/or...}
{for} {folder = 'myfolder' {recurse} or folder = 'myfolderhierarchy' 
{recurse}
or folder = . {recurse}} or ...} 
type { File | Folder | ChangeRequest | Requirement | Task | Topic | 
CustomComponentTypeName | Trace | ChangePackage }
[–epwdfile “passwordfilepat”] 
[-p "userName:password@hostName:endpoint/projectName/[viewName/][folderHierarchy/]"]

Parameters

For information about the command parameters, refer to Operation Parameters.

Example

The following example deletes all change requests with an open status from the StarDraw project StarDraw view.

stcmd connect Administrator:Administrator@localhost:49201 
stcmd set project = ‘StarDraw’ view = ‘StarDraw’
stcmd delete changerequest where query = "Status = Open" disconnect