CheckTableDataOnly 方法

为对该表定义的表数据测试数据库页的完整性。

命名空间:  Microsoft.SqlServer.Management.Smo
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
Public Function CheckTableDataOnly As StringCollection
用法
Dim instance As Table
Dim returnValue As StringCollection

returnValue = instance.CheckTableDataOnly()
public StringCollection CheckTableDataOnly()
public:
StringCollection^ CheckTableDataOnly()
member CheckTableDataOnly : unit -> StringCollection 
public function CheckTableDataOnly() : StringCollection

返回值

类型:System.Collections.Specialized. . :: . .StringCollection
一个 StringCollection 系统对象值,该值包含检查表的完整性的结果。结果中包括行数和页数。

注释

This method is functionally equivalent to the Transact-SQL DBCC CHECKTABLE table name NOINDEX statement. A sample return value would be:

DBCC results for 'Production.Product'.
There are 504 rows in 13 pages for object "Production.Product".
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

示例

C#

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

foreach (Table tb in db.Tables)
{
   foreach (String s in tb.CheckTableDataOnly())
   {
      Console.WriteLine(s);
   }
}

Powershell

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

foreach ($tb in $db.Tables)
{
   $tb.CheckTableDataOnly()
}