Statistic.Update Statistic.Update Statistic.Update Method

Definition

Updates information about the distribution of key values.

Overloads

Update() Update() Update()

Updates the statistics for the referenced object.

Update(StatisticsScanType) Update(StatisticsScanType) Update(StatisticsScanType)

Updates information about the distribution of key values.

Update(StatisticsScanType, Int32) Update(StatisticsScanType, Int32) Update(StatisticsScanType, Int32)

Updates information about the distribution of key values.

Update(StatisticsScanType, Int32, Boolean) Update(StatisticsScanType, Int32, Boolean) Update(StatisticsScanType, Int32, Boolean)

Updates information about the distribution of key values.

Update() Update() Update()

Updates the statistics for the referenced object.

public:
 void Update();
public void Update ();
Public Sub Update ()

Examples

Creating and Updating Statistics

Update(StatisticsScanType) Update(StatisticsScanType) Update(StatisticsScanType)

Updates information about the distribution of key values.

public:
 void Update(Microsoft::SqlServer::Management::Smo::StatisticsScanType scanType);
public void Update (Microsoft.SqlServer.Management.Smo.StatisticsScanType scanType);
Public Sub Update (scanType As StatisticsScanType)
Parameters

Remarks

StatisticsScanType are listed in the following table.

Member Description
Default Value = 5. Specifies that a percentage of the table or indexed view is used when collecting statistics. The actual percentage is calculated by the SQL Server engine automatically.
FullScan Value = 3. Specifies that all rows in the table or view are read when gathering statistics. This option must be used if a view is specified and it references more than one table.
Percent Value = 1. Specifies that a percentage of the table or indexed view is used when collecting statistics. This options cannot be used if a view is specified and it references more than one table. When specified, use the sampleValue argument to indicate number of rows.
Resample Value = 4. Specifies that the percentage ratio of the table or indexed view used when collecting statistics is inherited from existing the statistics
Rows Value = 2. Specifies that a number of rows in the table or indexed view are used when collecting statistics. This option cannot be used if a view is specified and it references more than one table. When specified, use the sampleValue argument to indicate number of rows

Update(StatisticsScanType, Int32) Update(StatisticsScanType, Int32) Update(StatisticsScanType, Int32)

Updates information about the distribution of key values.

public:
 void Update(Microsoft::SqlServer::Management::Smo::StatisticsScanType scanType, int sampleValue);
public void Update (Microsoft.SqlServer.Management.Smo.StatisticsScanType scanType, int sampleValue);
Public Sub Update (scanType As StatisticsScanType, sampleValue As Integer)
Parameters
sampleValue
Int32 Int32 Int32

Int32 - Specifies the percentage of the table or indexed view, or the number of rows to sample when collecting statistics for larger tables or views.

Remarks

StatisticsScanType are listed in the following table.

Member Description
Default Value = 5. Specifies that a percentage of the table or indexed view is used when collecting statistics. The actual percentage is calculated by the SQL Server engine automatically.
FullScan Value = 3. Specifies that all rows in the table or view are read when gathering statistics. This option must be used if a view is specified and it references more than one table.
Percent Value = 1. Specifies that a percentage of the table or indexed view is used when collecting statistics. This options cannot be used if a view is specified and it references more than one table. When specified, use the sampleValue argument to indicate number of rows.
Resample Value = 4. Specifies that the percentage ratio of the table or indexed view used when collecting statistics is inherited from existing the statistics
Rows Value = 2. Specifies that a number of rows in the table or indexed view are used when collecting statistics. This option cannot be used if a view is specified and it references more than one table. When specified, use the sampleValue argument to indicate number of rows

Update(StatisticsScanType, Int32, Boolean) Update(StatisticsScanType, Int32, Boolean) Update(StatisticsScanType, Int32, Boolean)

Updates information about the distribution of key values.

public:
 void Update(Microsoft::SqlServer::Management::Smo::StatisticsScanType scanType, int sampleValue, bool recompute);
public void Update (Microsoft.SqlServer.Management.Smo.StatisticsScanType scanType, int sampleValue, bool recompute);
Public Sub Update (scanType As StatisticsScanType, sampleValue As Integer, recompute As Boolean)
Parameters
sampleValue
Int32 Int32 Int32

Int32 - Specifies the percentage of the table or indexed view, or the number of rows to sample when collecting statistics for larger tables or views.

recompute
Boolean Boolean Boolean

Boolean - Specifies if statistics that are out of date are automatically recomputed

Remarks

StatisticsScanType are listed in the following table.

Member Description
Default Value = 5. Specifies that a percentage of the table or indexed view is used when collecting statistics. The actual percentage is calculated by the SQL Server engine automatically.
FullScan Value = 3. Specifies that all rows in the table or view are read when gathering statistics. This option must be used if a view is specified and it references more than one table.
Percent Value = 1. Specifies that a percentage of the table or indexed view is used when collecting statistics. This options cannot be used if a view is specified and it references more than one table. When specified, use the sampleValue argument to indicate number of rows.
Resample Value = 4. Specifies that the percentage ratio of the table or indexed view used when collecting statistics is inherited from existing the statistics
Rows Value = 2. Specifies that a number of rows in the table or indexed view are used when collecting statistics. This option cannot be used if a view is specified and it references more than one table. When specified, use the sampleValue argument to indicate number of rows

Applies to