다음을 통해 공유


UpdateStatisticsWith Method (Column, Index)

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 않도록 하고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

The UpdateStatisticsWith method forces data distribution statistics update for a referenced Microsoft SQL Server index, or for a hypothetical index used to support data distribution statistics for a column.

구문

object
.UpdateStatisticsWith(
ScanType [, ScanNumber ] [, ReCompute ] )

Parts

  • object
    Expression that evaluates to an object in the Applies To list.

  • ScanType
    Long integer that specifies a data sampling method as described in Settings.

  • ScanNumber
    Optional. A long integer that indicates a sample size as described in Settings.

  • ReCompute
    Optional. When TRUE (default), no change is made to automatic update of data distribution statistics. When FALSE, automatic update of data distribution statistics is disabled.

Prototype (C/C++)

HRESULT UpdateStatisticsWith(
SQLDMO_STAT_SCAN_TYPE ScanType,
long ScanNumber CPPDEFAULT( = 0),
BOOL ReCompute CPPDEFAULT( = TRUE);

Settings

Set ScanType by using these values. When a ScanType setting indicates a sample size, set ScanNumber as described.

Constant

Value

Description

SQLDMOStatistic_FullScan

3

Perform a full scan of the index or column to determine statistics values.

SQLDMOStatistic_Percent

1

Perform a sampled scan using a percentage value. When specified, use the ScanNumber value to indicate percentage. Specify percentage using a whole number, for example, 55 specifies 55 percent.

SQLDMOStatistic_Rows

2

Perform a sampled scan using a number of rows. When specified, use the ScanNumber argument to indicate number of rows.

SQLDMOStatistic_Sample

0

Perform a percentage sampled scan using a system defined percentage.

주의

Index-based, data distribution statistics support SQL Server query optimization. Data distribution statistics are calculated for an index when the index is first used in query optimization or at user direction. Statistics are updated automatically at configurable intervals and at user direction. The UpdateStatisticsWith method directs statistic update, optionally restricting statistics sampling to optimize the process.