Table.LockEscalation Property


Gets or sets the type of lock escalation that is used on the table.

Namespace:   Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

[SfcPropertyAttribute(SfcPropertyFlags.None | SfcPropertyFlags.Standalone | SfcPropertyFlags.SqlAzureDatabase | SfcPropertyFlags.Deploy)]
public LockEscalationType LockEscalation { get; set; }

Property Value

Type: Microsoft.SqlServer.Management.Smo.LockEscalationType

A LockEscalationType value that specifies the type of lock escalation that is used on the table.

The following code example shows how to set the lock escalation type used by the table, and display that information.


Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2012"];

Table tb = new Table(db, "Test Table");
Column col1 = new Column(tb, "Name", DataType.NChar(50));
Column col2 = new Column(tb, "ID", DataType.Int);

tb.LockEscalation = LockEscalationType.Auto;

Console.WriteLine("The table uses the " + tb.LockEscalation.ToString() + " escalation type.");


$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2012")

#Create the Table
$tb = new-object Microsoft.SqlServer.Management.Smo.Table($db, "Tesghjt Table")
$col1 = new-object Microsoft.SqlServer.Management.Smo.Column($tb, "Name", [Microsoft.SqlServer.Management.Smo.DataType]::NChar(50))
$col2 = new-object Microsoft.SqlServer.Management.Smo.Column($tb, "ID", [Microsoft.SqlServer.Management.Smo.DataType]::Int)
$tb.LockEscalation = [Microsoft.SqlServer.Management.Smo.LockEscalationType]::Auto

Write-Host "The table uses the" $tb.LockEscalation "escalation type."
Return to top