Remove-Row

Removes a row from a table.

Syntax

Remove-Row [-TableName] <String> [-SchemaName <String>] [-Where] <String> [<CommonParameters>]
Remove-Row [-TableName] <String> [-SchemaName <String>] -All [-Truncate] [<CommonParameters>]

Description

To specify which columns to insert into the new row, pass a hashtable as a value to the Column parameter. This hashtable should have keys that map to column names, and the value of each key will be used as the value for that column in the row.

Parameters

Name Type Description Required? Pipeline Input Default Value
TableName String

The name of the table.

true false
SchemaName String

The schema name of the table. Default is dbo.

false false dbo
Where String

The condition to use for choosing which rows to remove. This parameter is required, unless you really want to

true false
All SwitchParameter

Drop all the rows in the table.

true false False
Truncate SwitchParameter

Truncate the table instead to delete all the rows. This is faster than using a delete statement.

false false False

EXAMPLE 1

Remove-Row -SchemaName 'rivet' 'Migrations' 'MigrationID=20130913132411'

Demonstrates how to delete a specific set of rows from a table.

EXAMPLE 2

Remove-Row 'Cars' -All

Demonstrates how to remove all rows in a table.