Skip to content

Commit 99ca99b

Browse files
authored
Merge pull request #15307 from Matteo-T/patch-10
Minor updates to the C# and PowerShell samples
2 parents aeac6b1 + 2843b24 commit 99ca99b

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

docs/relational-databases/server-management-objects-smo/tasks/creating-and-updating-statistics.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static void CreatingAndUpdatingStatistics()
6565
var db = srv.Databases["AdventureWorks"];
6666

6767
// Reference the CreditCard table.
68-
var tb = db.Tables["CreditCard", "dbo"];
68+
var tb = db.Tables["CreditCard", "Sales"];
6969

7070
// Define a Statistic object by supplying the parent table and name
7171
// arguments in the constructor.
@@ -81,10 +81,12 @@ public static void CreatingAndUpdatingStatistics()
8181

8282
// List all the statistics object on the table (you will see the newly created one)
8383
foreach (var s in tb.Statistics.Cast<Statistic>())
84-
Console.WriteLine($"{s.ID}\t{s.Name}");
84+
Console.WriteLine($"{s.ID}\t{s.Name}");
8585

86-
// Output:
87-
// 2 Test_Statistics
86+
// Output:
87+
// 2 AK_CreditCard_CardNumber
88+
// 1 PK_CreditCard_CreditCardID
89+
// 3 Test_Statistics
8890
}
8991
```
9092

@@ -118,4 +120,12 @@ $stat.Create()
118120
119121
# Finally dump all the statistics (you can see the newly created one at the bottom)
120122
$tb.Statistics
121-
```
123+
124+
# Output:
125+
# Name Last Updated Is From Index Statistic Columns
126+
# Creation
127+
# ---- ------------ -------------- -----------------
128+
# AK_CreditCard_CardNumber 10/27/2017 2:33 PM True {CardNumber}
129+
# PK_CreditCard_CreditCardID 10/27/2017 2:33 PM True {CreditCardID}
130+
# Test_Statistics 6/4/2020 8:11 PM False {CardType}
131+
```

0 commit comments

Comments
 (0)